I am using Confide (v3.2) and Entrust(v1.2) with Frozennode Administrator. In the config file there is an option which I need to set that will return true/false depending on if the user is authenticated.
/**
* The permission option is the highest-level authentication check that lets you define a closure that should return true if the current user
* is allowed to view the admin section. Any "falsey" response will send the user back to the 'login_path' defined below.
*
* @type closure
*/
'permission'=> function()
{
return Auth::check();
},
It is using the default Laravel Auth:check(); I used confide Confide to authenticate users, but it just verifies any User is authenticated and I need to make sure they have the Admin role to use the Administrator. I am using Entrust for roles and want to get the equivalent. I only see in the documentation for Entrust to use
$user->hasRole("Admin");
But I know this won't work because $user is not defined. How do I do this?
Auth::check()
, perhaps you could also useAuth::user()->hasRole('Admin')
to get the current user's status? Probably not, but I thought I'd throw it out there. :) – Joel Hinz