Open leo-unglaub opened 5 years ago
@leo-unglaub , you're correct. Provided example as well as default policies implementations are misleading.
On the other hand $user
is passed to the callback anyway, so providing $post
would be sufficient in this case (but still not required):
public function view($user, $post)
{
return Gate::any(['viewBlog', 'manageBlog'], $post);
}
https://laravel.com/docs/7.x/authorization#writing-gates
Gates always receive a user instance as their first argument, and may optionally receive additional arguments such as a relevant Eloquent model
Hey, i am looking thru your documentation and i found this here:
But i cannot find an implementation of
Gate::any
with that signature (with three params). Are you sure this is intended? Or did you mean:Thanks and greetings Leo