Laravel 5.1 @can, how use OR clause

Marcaum54 picture Marcaum54 · Dec 9, 2015 · Viewed 26.3k times · Source

I did not find how to use a clause (OR, AND) in view with @can, for checking multiple abilities ...

I tried:

@can(['permission1', 'permission2']) 
@can('permission1' or 'permission2')
@can('permission1' || 'permission2')

But dont work ;(

Answer

tommy picture tommy · Dec 9, 2015

You can use the Gate facade:

@if(Gate::check('permission1') || Gate::check('permission2'))

@endif