Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed unused model_variable in the policy stubs #383

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

77120bd
Copy link

@77120bd 77120bd commented May 16, 2024

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.

Copy link

what-the-diff bot commented May 16, 2024

PR Summary

  • Modification of Method Signatures
    This update changes how some methods (view, update, delete, forceDelete, restore, and replicate) in the DefaultPolicy.stub file operate. Specifically, a variable (the "model_variable") that used to be required for these methods to run has been removed. This could simplify how these methods are used and potentially enhance the efficiency of the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant