我使用 laravel 和 SmartAdmin UI 作为管理面板来过度处理系统。我已经在我的系统中实现了角色和权限。
如果我使用像 index.blade.php 这样的常用刀片,我可以使用 @can 配置权限,如下所示
@can('view_document')
//////
@endcan
但是由于我使用管理面板和使用config.ui的菜单,我不知道如何在我的代码中实现end @can @endcan
<?php
//CONFIGURATION for SmartAdmin UI
//ribbon breadcrumbs config
//array("Display Name" => "URL");
$breadcrumbs = array(
"Home" => APP_URL
);
/*navigation array config
ex:
"dashboard" => array(
"title" => "Display Title",
"url" => "http://yoururl.com",
"url_target" => "_blank",
"icon" => "fa-home",
"label_htm" => "<span>Add your custom label/badge html here</span>",
"sub" => array() //contains array of sub items with the same format as the parent
)
*/
$page_nav = array(
"dashboard" => array(
"title" => "Dashboard",
"url" => "ajax/dashboard.php",
"icon" => "fa-home"
),
);
//configuration variables
$page_title = "";
$page_css = array();
$no_main_header = false; //set true for lock.php and login.php
$page_body_prop = array(); //optional properties for <body>
$page_html_prop = array(); //optional properties for <html>
?>
我想要的是,我可以在菜单上使用@can @endcan 功能,所以用户只能根据他们的角色和权限访问菜单。
我尝试在“仪表板”=>数组之前添加@can(但给我一个错误