Search code examples
phplaravelpermissionslaravel-permission

Laravel - Spatie permissions saying permission doesn't exist


I've got a FormRequest class set up that is doing

public function authorize()
{
    return Auth::user()->hasPermissionTo('can update users');
}

however it is throwing an exception

the exception

However in my database the permission definately exists

image of database

Is there some form of naming convention I need to be using or something I could be doing wrong?

Thanks


Solution

  • Try clearing Laravel's cache, this can happen if permissions are added without being picked up by the cache.