9
I wonder if it is problematic to do this kind of validation in the views of Laravel
.
Example: Only a master user can delete certain record, so I present the delete button only if the user is master (logically validating the deletions on Controller
).
Exemplifying in code:
@if(Auth::user()->administrator)
<a title="Excluir" href="/users/delete/{{$user->id}}">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</a>
@endif
It is correct to do so or it is preferable to create new views for an administrator user if he has fewer privileges than an ordinary user?
I do it like this. For me it’s right and it’s working.
– Diego Souza
I also do rsrs, but I would like to know several opinions
– Felipe Paetzold