/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         return redirect('/cms');
     }
     $response = $next($request);
     if (isset($this->auth->user()->id)) {
         $logModel = new \App\LogRegistry();
         $logModel->user_id = $this->auth->user()->id;
         $logModel->event = 'Loggin into CMS';
         $logModel->controller = 'App\\Http\\Controllers\\Auth\\AuthController@getLogin?';
         $logModel->short_path = null;
         $logModel->save();
     }
     return $response;
 }
Esempio n. 2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $event = '')
 {
     //$response = $next($request);
     $user = $request->user()->id;
     $controller = $request->route()->getAction()['controller'];
     $short_path = $request->route()->getAction()['as'];
     if (null !== $request->route()->parameters() && !empty($request->route()->parameters()) && $request->route()->parameters() != '') {
         $parameters = json_encode($request->route()->parameters());
     } else {
         $parameters = null;
     }
     $logModel = new \App\LogRegistry();
     $logModel->user_id = $user;
     $logModel->controller = $controller;
     $logModel->short_path = $short_path;
     $logModel->event = $event;
     $logModel->parameters = $parameters;
     $logModel->save();
     return $next($request);
 }