Laravel backpack supports multi roles in blade template

更新日期: 2019-06-24 阅读次数: 5479 字数: 50 分类: backpack

As document, use hasanyrole(Role::all()) to support multi roles in blade template.

https://github.com/Laravel-Backpack/PermissionManager

@hasanyrole(Role::all())
    I have one or more of these roles!
@else
    I have none of these roles...
@endhasanyrole

Error shows:

[2019-06-24 14:29:36] production.ERROR: Class 'Role' not found (View: vendor/backpack/base/inc/sidebar.blade.php) 

Solution:

@hasanyrole(['admin', 'role1', 'role2'])

微信关注我哦 👍

大象工具微信公众号

我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式