I'm trying to enable only admin users to be able to view certain contents of a navbar in my laravel project. I have a users
table with a role column consisting of 'admin' and 'user' values which I use in my middleware to allow admin users to access an admin panel for CRUD operations.
I've tried:
@if(auth()->check())
@if(Auth::user()->get(array('users.role')) == 'admin')
'THIS IS WHAT I WANT ONLY ADMIN USERS TO SEE!'
@endif
@endif
Yet, when logged into an 'admin' user, I still can't see admin-only content. I'm fairly new to the framework, but if anyone has any advice I would highly appreciate it!
Thanks,
Sam