I have role column in users table, and I want to check the value like this in the blade file :
@if ( {{Auth::user()->role }} == '1')
// do something
@endif
Is it possible ?
I have role column in users table, and I want to check the value like this in the blade file :
@if ( {{Auth::user()->role }} == '1')
// do something
@endif
Is it possible ?
In blade files, you need to write plain PHP into the @if
and others blade statements. So you would need to remove the {{ }}
:
@if ( auth()->user()->role == 1)
// do something
@endif