Laravel Blade Check If User Not Have a Permission Inside Array of Permission

Can you guys help me? I just want to know how to check if the user do not have a permission from an array of permission on laravel blade. I think is the inverse of @canany

Maybe the illustration in my head is like this :

if( !($user->canany(['store', 'update'])) ) {
   // user don't have store or update permission
}

For now my code is like :

@canany($permissions)
  // user have the permission, but i don't need this section
@else
  // user don't have the permission, but i need this section
@endcanany

Because of that, I want my to code in my blade file is like :

@inverseCanAny($permissions)
   // do something when user don't have the permissions
@endInverseCanAny

Sorry if my English is bad

Thank you!

Upvotes: -1

Views: 355

Answers (1)

try @cannot

this references may help you

  1. @cannot statement from Blade engine not working
  2. https://spatie.be/docs/laravel-permission/v5/basic-usage/blade-directives

or just let it empty and only fill the else condition

Upvotes: 0

Related Questions