Thursday, May 3, 2018

Laravel Entrust Permissions disable text input - development

Laravel Entrust Permissions disable text input

I’m trying to use a permission where if a user have it then the user will be able to edit a text field in a form, otherwise, the field will be disabled.

I know I can add a disabled parameter here

What should I do to achieve what I need to do without having to write my HTML form twice? Here’s my form:

 @if (Auth::user()->can(Permission::EDIT_INFO))
        <tr>
            <th>Name 1:</th>
                <td>
                
                </td>
            <th>Name 2:</th>
                <td>
                
                </td>
        </tr>
 @endif

In other words: (if have permission show normal form else show the same form but disabled fields)



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-entrust-permissions-disable-text-input/
via Lzo Media

No comments:

Post a Comment