Skip to content

Commit 4b9ab0d

Browse files
committed
Add BelongsToMany relationship for SP2D in KerangkaAcuan and implement policy methods for attachment
1 parent d2eeb68 commit 4b9ab0d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

app/Nova/KerangkaAcuan.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use App\Nova\Metrics\MetricValue;
1515
use Illuminate\Database\Eloquent\Model;
1616
use Laravel\Nova\Fields\BelongsTo;
17+
use Laravel\Nova\Fields\BelongsToMany;
1718
use Laravel\Nova\Fields\Boolean;
1819
use Laravel\Nova\Fields\Date;
1920
use Laravel\Nova\Fields\FormData;
@@ -137,6 +138,7 @@ public function fields(NovaRequest $request)
137138
HasMany::make('Anggaran', 'anggaranKerangkaAcuan', AnggaranKerangkaAcuan::class),
138139
HasMany::make('Spesifikasi', 'spesifikasiKerangkaAcuan', SpesifikasiKerangkaAcuan::class),
139140
HasMany::make('Arsip Dokumen', 'arsipDokumen', ArsipDokumen::class),
141+
BelongsToMany::make('SP2D', 'daftarSp2d', DaftarSp2d::class),
140142
]),
141143
];
142144
}

app/Policies/KerangkaAcuanPolicy.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,19 @@ public function runAction(User $user, KerangkaAcuan $kerangkaAcuan): bool
9090
->withYear(Helper::getYearFromDate($kerangkaAcuan->tanggal))
9191
->get();
9292
}
93+
94+
public function attachDaftarSp2d(): bool
95+
{
96+
return false;
97+
}
98+
99+
public function attachAnyDaftarSp2d(): bool
100+
{
101+
return false;
102+
}
103+
104+
public function detachAnyDaftarSp2d(): bool
105+
{
106+
return false;
107+
}
93108
}

0 commit comments

Comments
 (0)