Skip to content

Commit 409cb2f

Browse files
committed
Refactor policies to remove unnecessary user parameters in viewAny and create methods
1 parent b7f887b commit 409cb2f

File tree

4 files changed

+6
-23
lines changed

4 files changed

+6
-23
lines changed

app/Nova/KerangkaAcuan.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use App\Nova\Metrics\MetricValue;
1515
use Illuminate\Database\Eloquent\Model;
1616
use Laravel\Nova\Fields\BelongsTo;
17-
use Laravel\Nova\Fields\BelongsToMany;
1817
use Laravel\Nova\Fields\Boolean;
1918
use Laravel\Nova\Fields\Date;
2019
use Laravel\Nova\Fields\FormData;
@@ -135,7 +134,6 @@ public function fields(NovaRequest $request)
135134
$query->has('daftarSp2d', '<=', $value);
136135
})
137136
->onlyOnIndex(),
138-
BelongsToMany::make('SP2D', 'daftarSp2d', 'App\Nova\DaftarSp2d'),
139137
Tab::group('Detail', [
140138
HasMany::make('Anggaran', 'anggaranKerangkaAcuan', 'App\Nova\AnggaranKerangkaAcuan'),
141139
HasMany::make('Spesifikasi', 'spesifikasiKerangkaAcuan', 'App\Nova\SpesifikasiKerangkaAcuan'),

app/Policies/KerangkaAcuanPolicy.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class KerangkaAcuanPolicy
1212
/**
1313
* Determine whether the user can view any models.
1414
*/
15-
public function viewAny(User $user): bool
15+
public function viewAny(): bool
1616
{
1717
return Policy::make()
1818
->notAllowedFor('admin')
@@ -33,7 +33,7 @@ public function view(User $user, KerangkaAcuan $kerangkaAcuan): bool
3333
/**
3434
* Determine whether the user can create models.
3535
*/
36-
public function create(User $user): bool
36+
public function create(): bool
3737
{
3838
return Policy::make()
3939
->allowedFor('koordinator,anggota')
@@ -90,19 +90,4 @@ public function runAction(User $user, KerangkaAcuan $kerangkaAcuan): bool
9090
->withYear(Helper::getYearFromDate($kerangkaAcuan->tanggal))
9191
->get();
9292
}
93-
94-
public function attachDaftarSp2d()
95-
{
96-
return false;
97-
}
98-
99-
public function attachAnyDaftarSp2d()
100-
{
101-
return false;
102-
}
103-
104-
public function detachDaftarSp2d()
105-
{
106-
return false;
107-
}
10893
}

app/Policies/PersediaanKeluarPolicy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PersediaanKeluarPolicy
1212
/**
1313
* Determine whether the user can view any models.
1414
*/
15-
public function viewAny(User $user): bool
15+
public function viewAny(): bool
1616
{
1717
return Policy::make()
1818
->allowedFor('bmn')
@@ -33,7 +33,7 @@ public function view(User $user, PersediaanKeluar $persediaanKeluar): bool
3333
/**
3434
* Determine whether the user can create models.
3535
*/
36-
public function create(User $user): bool
36+
public function create(): bool
3737
{
3838
return Policy::make()
3939
->allowedFor('bmn')

app/Policies/PersediaanMasukPolicy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PersediaanMasukPolicy
1212
/**
1313
* Determine whether the user can view any models.
1414
*/
15-
public function viewAny(User $user): bool
15+
public function viewAny(): bool
1616
{
1717
return Policy::make()
1818
->allowedFor('bmn')
@@ -33,7 +33,7 @@ public function view(User $user, PersediaanMasuk $persediaanMasuk): bool
3333
/**
3434
* Determine whether the user can create models.
3535
*/
36-
public function create(User $user): bool
36+
public function create(): bool
3737
{
3838
return Policy::make()
3939
->allowedFor('bmn')

0 commit comments

Comments
 (0)