Level 2
Hi, have you solved this? I have the same issue here!
I am thinking about adding Laratrust to my Lumen 5.4 project. How difficult is to implement with JWT-Auth? Is it just as simple as doing this in the controller
if (JWTAuth::user()->hasRole('admin'))
{
// do something
}
How would I go about adding ACL to a route like this if the user has to be an admin but also authorized?
$app->group(['middleware' => ['auth']], function($app) {
$app->get('/test', [
'uses' => 'LoginController@getTestTable'
]);
Would I have to override any methods like for handling requests?
public function handle($request, Closure $next, $guard = null)
{
if ($this->auth->guard($guard)->guest()) {
return response('Unauthorized.', 401);
}
return $next($request);
}
Please or to participate in this conversation.