Laravel 5.1 @can, how use OR clause

后端 未结 8 1348
日久生厌
日久生厌 2021-02-06 22:40

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

I tried:

@can([\'permission1\', \'permission2\']) 
@c         


        
8条回答
  •  深忆病人
    2021-02-06 23:25

    The @canany blade directive has been added to Laravel v.5.6.23 on May 24, 2018

    Usage:

    @canany(['edit posts', 'delete posts'])
        
    @can('edit posts') @endcan @can('delete posts') @endcan
    @endcanany

提交回复
热议问题