Add policy for action events
This commit is contained in:
@@ -27,7 +27,7 @@ class LoanOrderFieldsForDetail
|
||||
/**
|
||||
* Loan order fields for detail
|
||||
*/
|
||||
public static function make(): array
|
||||
public static function make($resource): array
|
||||
{
|
||||
return [
|
||||
ID::make()->hide(),
|
||||
@@ -160,8 +160,8 @@ class LoanOrderFieldsForDetail
|
||||
->size('w-1/2'),
|
||||
]),
|
||||
|
||||
MorphMany::make(__('Actions'), 'actions', config('nova.actions.resource'))
|
||||
->canSeeWhen('isAdmin', $this)
|
||||
// MorphMany::make(__('Actions'), 'actions', config('nova.actions.resource'))
|
||||
// ->canSee(fn () => true)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ class LoanOrder extends Resource
|
||||
*/
|
||||
public function fieldsForDetail(): array
|
||||
{
|
||||
return LoanOrderFieldsForDetail::make();
|
||||
return LoanOrderFieldsForDetail::make($this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,6 +380,9 @@ class LoanOrder extends Resource
|
||||
->creationRules('required')
|
||||
->updateRules('nullable'),
|
||||
]),
|
||||
|
||||
MorphMany::make(__('Actions'), 'actions', config('nova.actions.resource'))
|
||||
->canSee(fn ($request) => false)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user