以下代码仅授予admin
和user_a
以查看表单。但是我想让表格的一部分只有user_a
可读。
@if(Auth::user()-> user_role == "admin" || Auth::user()-> user_role == "user_a")
//form
@endif
答案 0 :(得分:0)
试试这个:
@if(Auth::user()-> user_role == "admin" || Auth::user()-> user_role == "user_a")
//form
// specific section
@if(Auth::user()-> user_role == "user_a")
// This section is visible to the role user_a only
@endif
@endif