/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $uri = $_SERVER['REQUEST_URI'];
     $ip = $request->ip();
     \Log::info("{$ip} {$uri}");
     return $next($request);
 }
 /**
  * Run the request filter.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $route = \Route::getCurrentRoute();
     // $route->uri(), $request->path()
     $roles = \Auth::user()->roles;
     $allow = true;
     try {
         // Check if route has permission
         foreach ($roles as $role) {
             foreach ($role->permissions as $permission) {
                 $allow = $allow & !$this->denied($request, $route, $permission);
             }
         }
     } catch (\Exception $e) {
         \Log::error($e->getFile() . ':' . $e->getLine() . ' ' . $e->getMessage());
         $allow = false;
     }
     // Apply access
     \Log::info('ACCESS:' . \Auth::user()->name . ':' . $request->method() . ':' . $request->path() . ':' . ($allow ? 'ALLOWED' : 'DENIED'));
     if (!$allow) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return response(view('admin/unauthorized'), 401);
         }
     } else {
         return $next($request);
     }
 }
 public function handle($request, Closure $next)
 {
     $today = Carbon::now('Asia/Manila');
     $report_date = Config::find(1);
     // Send a report if today is not set to our config table
     if ($report_date->report_date->day != $today->day || $report_date->report_date->month != $today->month || $report_date->report_date->year != $today->year) {
         $report_date->report_date = $today;
         $report_date->save();
         $deadline_names = [];
         $i = new \App\Info();
         foreach (\App\Info::all() as $info) {
             $deadline = $i->isDeadLineToday($info->dead_line);
             if ($deadline == 'deadline' && $info->claim_status != 'approved') {
                 $deadline_names[$info->name] = $info;
             }
         }
         $data = array('data' => $deadline_names);
         \Log::info('Sending mail....');
         \Mail::send('email.email', $data, function ($message) {
             $message->from('*****@*****.**', 'GIBX Internal System');
             $date = \Carbon\Carbon::today('Asia/Manila')->format('d/m/Y');
             $recipients = ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'];
             $message->to($recipients)->subject('GIBX Claims System Daily Report ' . $date);
         });
         // TODO: Send an email for reporting here...
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     \Log::info(sprintf("\n\n[Request] Started to %s routed to %s", $request->path(), $request->route()->getAction()['controller']));
     $before = microtime(true);
     $response = $next($request);
     $after = microtime(true);
     \Log::info(sprintf("[Request] Responded %d in %dms", $response->status(), ($after - $before) * 1000));
     return $response;
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     \Log::info($request->method());
     $hasPermission = true;
     $method = $request->method();
     if (strpos($request->path(), 'todo') !== false && ($method == 'PUT' || $method == 'DELETE')) {
         $id = $request->segment(2);
         $todo = Todo::find($id);
         $hasPermission = $todo ? Auth::user()->id == $todo->user_id : true;
     }
     return $hasPermission ? $next($request) : response('Unauthorized.', 401);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $openid = Session::get('openid');
     if (!$openid) {
         \Log::info("not found openid in session");
         $appid = Config::get("weixin.seller.appid");
         Session::put('request_url', $request->getUri());
         $authUrl = route("wx-auth");
         \Log::info($authUrl);
         $snsapi_base = sprintf(self::SNSAPI_BASE, config('wx_qy.corpID'), urlencode($authUrl), 'cy123456');
         return redirect($snsapi_base);
     }
     \Log::info("success found openid in session");
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  *
  * @return mixed
  */
 public function handle($request, \Closure $next)
 {
     \Log::info('処理終了。', ['Ip' => \Request::server('REMOTE_ADDR'), 'SessionId' => \Session::getId(), 'url' => \Request::url(), 'method' => \Request::method()]);
     return $next($request);
 }
Example #8
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     \Log::info('request', $request->toArray());
     return $next($request);
 }
Example #9
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     \Log::info($request->ip() . " accessed " . $request->path() . " using method " . $request->method());
     return $next($request);
 }
Example #10
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     \Log::info(sprintf("METHOD=%s URL=%s", $request->method(), $request->url()));
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     \Log::info($request->ip());
     return $next($request);
 }
Example #12
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // handle() can have another parameters
     \Log::info($request->ip);
     return $next($request);
 }