예제 #1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $authorized = $this->auth->hasRouteAccess($request->route());
     if (!$authorized) {
         if (config('auth.unauthorized_redirect')) {
             return Redirect::route(config('auth.unauthorized_redirect_route'))->with('messages', ['error' => trans('identify::messages.unauthorized')]);
         }
         abort(config('auth.unauthorized_error_code'));
     }
     return $next($request);
 }