bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`
MIT License
1.6k stars 180 forks source link

Removed unused model_variable in the policy stubs #383

Closed 77120bd closed 1 month ago

77120bd commented 4 months ago

I got an error when using AnyResource::can('view')

Too few arguments to function App\Policies\AnyPolicy::view(), 1 passed in /var/www/html/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 811 and exactly 2 expected

It needs a second parameter which isn't used in the methods. public function view(User $user, Model $model): bool { return $user->can('view_model'); }

I removed the second parameter from the stub files to fix the issue.

what-the-diff[bot] commented 4 months ago

PR Summary

bezhanSalleh commented 1 month ago

The default definition for the view policy method in laravel is the same as the stub we are using in shield. so if you want to change the definition that's dev land but the default will stay the same. thanks. fyi... when you have some custom code in the policies the generate command has a flag to not override them.