Add policy for action events

This commit is contained in:
nurmuhammet committed 2023-12-08 10:45:01 +05:00
1 parent 374dfe8da1
commit a4265e488c
4 files changed
+96 -8

No files matched your search

@@ -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 @@ public static function make(): array
->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)
];
}
}
+4 -1
View File
@@ -157,7 +157,7 @@ public function fieldsForIndex(NovaRequest $request): array
*/
public function fieldsForDetail(): array
{
return LoanOrderFieldsForDetail::make();
return LoanOrderFieldsForDetail::make($this);
}
/**
@@ -380,6 +380,9 @@ public function fields(NovaRequest $request): array
->creationRules('required')
->updateRules('nullable'),
]),
MorphMany::make(__('Actions'), 'actions', config('nova.actions.resource'))
->canSee(fn ($request) => false)
];
}