Answer the question
In order to leave comments, you need to log in
How to properly declare gate in laravel?
In App\Providers\AuthServiceProvider.php I declare Gate
public function boot()
{
$this->registerPolicies();
Gate::define('delete_item', function ($user_role) {
return $user_role === 'admin';
});
}
@can('delete_item', $role)
код
@endcan
Answer the question
In order to leave comments, you need to log in
Well, try reading the documentation. Who told you that the first variable in your callback will be yours?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question