Answer the question
In order to leave comments, you need to log in
How to make Auth::check() && login == 'HeartProgrammer'?
I am building an online sporting goods store. It is necessary to make sure that the "Edit" and "Delete" buttons are only available to one user - "Administrator".
It is necessary that the conditions are compared with the user by login or by boolean type.
I don't know how to do this in laravel.
So far my code is like this:
@if(Auth::check())
<p><a href="#" class="btn btn-success" role="button">Редактировать</a> <a href="#" class="btn btn-danger" role="button">Удалить</a></p>
@endif
Answer the question
In order to leave comments, you need to log in
You need to make roles and accesses in the application. It will be more correct.
Look towards the Entrust
or
Sentinel
package
. The first one works on standard authentication, and the second one works with its own. We'll have to change the structure a bit.
And as a last resort
@if(Auth::check() && (Auth::user()->is_admin)
<p><a href="#" class="btn btn-success" role="button">Редактировать</a> <a href="#" class="btn btn-danger" role="button">Удалить</a></p>
@endif
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question