authenticate($request, $guards); $customer = current_customer(); if ($customer->status != 1) { Auth::guard(Customer::AUTH_GUARD)->logout(); return redirect(shop_route('login.index')); } return $next($request); } /** * Get the path the user should be redirected to when they are not authenticated. * * @param Request $request */ protected function redirectTo($request) { if (! $request->expectsJson()) { return shop_route('login.index'); } } /** * Handle an unauthenticated user. * * @param Request $request * @param array $guards * @return void * * @throws AuthenticationException */ protected function unauthenticated($request, array $guards) { throw new AuthenticationException( trans('common.unauthenticated'), $guards, $this->redirectTo($request) ); } }