/**
  * @param \App\Repositories\ActivityRepository $activityRepository
  *
  * @return \Illuminate\Http\Response
  */
 public function index(ActivityRepository $activityRepository)
 {
     $logItems = $activityRepository->getLatest();
     $view = view('back.dashboard.index')->with(compact('logItems'));
     if (config('laravel-analytics.siteId') == '') {
         return $view;
     }
     $analyticsData = LaravelAnalytics::getVisitorsAndPageViews(14);
     $dates = $analyticsData->lists('date')->toArray();
     $visitors = $analyticsData->lists('visitors')->toArray();
     $pageViews = $analyticsData->lists('pageViews')->toArray();
     $view = $view->with(compact('dates', 'visitors', 'pageViews'));
     return $view;
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         $response = $this->auth->onceBasic();
         if ($response) {
             // Log the action to the Activity Log
             $message = Lang::get('esensi/activity::activity.messages.unauthorized');
             Activity::addAction($message, ['code' => 401, 'label' => 'esensi.core.unauthorized']);
             // Block the request for AJAX
             return $response;
         }
     }
     return $next($request);
 }
Beispiel #3
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         // Log the action to the Activity Log
         $message = Lang::get('esensi/activity::activity.messages.unauthorized');
         Activity::addAction($message, ['code' => 401, 'label' => 'esensi.core.unauthorized']);
         // Block the request for AJAX
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         }
         // Redirect to a safe route
         $options = $request->route()->getAction();
         $fragment = array_get($options, 'fragment');
         $url = route('users.login');
         $url = $fragment ? $url . '#' . $fragment : $url;
         return redirect()->guest($url);
     }
     return $next($request);
 }
 /**
  * Display a listing of the resource.
  *
  * @param ActivityRepository $activityRepository
  *
  * @return Response
  */
 public function index(ActivityRepository $activityRepository)
 {
     $logItems = $activityRepository->getPaginator(50);
     return view('back.activitylog.index')->with(compact('logItems'));
 }