如何使表单对用户可读并可编辑为另一个用户

时间:2017-03-07 11:19:43

标签: php laravel-5

以下代码仅授予adminuser_a以查看表单。但是我想让表格的一部分只有user_a可读。

@if(Auth::user()-> user_role == "admin" || Auth::user()-> user_role == "user_a")   
//form   
@endif

1 个答案:

答案 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