I would like to check account status in Middleware. The status is represented by tinyint. if it is 1 then it is activated, otherwise 0.
In App\Http\Middleware\Authenticate, I have:
public function handle($request, Closure $next)
{
if ($request->input('status') == 0)
{
Session::flash('message', 'Your account hasn\'t been activated, please try again later.');
return redirect('/');
}
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('auth/login');
}
}
return $next($request);
}
$request->input('status') == 0 is probably wrong. How should I do this?