/**
  * Create comment report
  *
  * @param User $user
  * @param Comment $comment
  * @return mixed
  */
 public function createCommentReport(User $user, Comment $comment)
 {
     if ($this->commentReport->findByUserAndComment($user, $comment)) {
         return false;
     }
     $this->stat->increment('reports');
     return $this->commentReport->create($user, $comment);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (php_sapi_name() == 'cli' || !INSTALLED) {
         return $next($request);
     }
     $lastUpdate = $request->cookie('last_visit');
     if (!$lastUpdate || $lastUpdate->day != Carbon::now()->day) {
         $this->stat->increment('visits');
         $cookie = $this->cookieJar->forever('last_visit', Carbon::now());
         $this->cookieJar->queue($cookie);
     }
     return $next($request);
 }
 /**
  * Admin dashboard
  *
  * @param StatContract $stat
  * @return \Illuminate\View\View
  */
 public function dashboard(StatContract $stat)
 {
     $data = ['visitsNow' => $stat->get('visits'), 'visitsThen' => $stat->get('visits', -1), 'usersNow' => $stat->get('users'), 'usersThen' => $stat->get('users', -1), 'postsNow' => $stat->get('posts'), 'postsThen' => $stat->get('posts', -1), 'reportsNow' => $stat->get('reports'), 'reportsThen' => $stat->get('reports', -1), 'chartData' => $stat->all('visits', 6), 'totalVisits' => $stat->count('visits'), 'totalPosts' => $stat->count('posts'), 'totalUsers' => $stat->count('users'), 'totalReports' => $stat->count('reports')];
     return $this->view('dashboard', $data);
 }
 /**
  * Handle the event.
  *
  * @param UserCreatedThroughOAuth $event
  */
 public function handle(UserCreatedThroughOAuth $event)
 {
     $this->stat->increment('users');
 }
Пример #5
0
 /**
  * Handle the event.
  *
  * @param  UserWasCreated  $event
  * @return void
  */
 public function handle(UserWasCreated $event)
 {
     $this->stat->increment('users');
 }
Пример #6
0
 /**
  * Handle the event.
  *
  * @param  PostWasCreated  $event
  * @return void
  */
 public function handle(PostWasCreated $event)
 {
     $this->stat->increment('posts');
 }