Croco
Model Policy on page not working
I followed this https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component#adding-the-table to create a table inside a page. Even if I remove the header buttons:
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]); it should probably just hide the button, anyway in my case i need to show the checkboxes, so I keep the buttons for now. What i would like you to help me is apply my policy on this table. i have this:
protected $policies = [
Order::class => OrderPolicy::class,
];
on OrderPolicy.php:
public function delete(User $user, Order $model): bool
{ logger("delete");
return $user->can('SuperAdmin');
}
but this method is never called when record is deleted.
8 replies