Пример #1
0
 /**
  * Filter the incoming requests.
  */
 public function filterRequests(Route $route, Request $request)
 {
     // Store the Request instance for further processing.
     $this->request = $request;
     // Check the User Authorization.
     if (Auth::user()->hasRole('administrator')) {
         // The User is authorized; continue the Execution Flow.
         return null;
     }
     if ($request->ajax()) {
         // On an AJAX Request; just return Error 403 (Access denied)
         return Response::make('', 403);
     }
     // Redirect the User to his/hers Dashboard with a warning message.
     $status = __d('files', 'You are not authorized to access this resource.');
     return Redirect::to('admin/dashboard')->withStatus($status, 'warning');
 }