I have this middleware:
public function handle($request, Closure $next)
{
    $response = $next($request);
    $user = $this->auth->getUser(); 
    if ($user->role_id == 1) {
        return $response;
    } else {
        return response('Unauthorized.', 401);
    }
}
i want to use this middleware when call profile page and the code in route is:
Route::get('profile', ['middleware' => 'superAdmin', 'uses' => 'users\UserController@index']);
and I added it to $routeMiddleware array in kernel.php
when call the page:
http://localhost:8080/public/profile
got this error:
ErrorException in SuperAdminRoleMiddleware.php line 43: Trying to get property of non-object
line 43 is: if ($user->role_id == 1) {
what is the issue:
