I Have A Page That Shows a Table , I want to hide only 1 Columns Of My table and only show to Admin User role .
But I want to show other columns to my guest users that have not logged in my site.
when i do with this code :
<table>
<tr>
<td>
...
</td>
@if(Auth::user()->isAdmin())
<td>
only Admins Can See This Column
</td>
@endif
<td>
...
</td>
</tr>
</table>
It Hide All of page and redirect to login and show only to admin users.
But I need to show all my tables without that column to guset users that not logged in, How should i do that?
I found The solution ::: We can hide for guest and show to our role users by this code :
<table>
<tr>
<td>
...
</td>
@if(Auth()->check() and Auth::user()->isAdmin())
<td>
only Admins Can See This Column
</td>
@endif
<td>
...
</td>
...
</td>
</tr>
</table>