/**
  * Handle the passed event.
  *
  * @param  ThreadWasViewed  $event
  * @return void
  */
 public function handle(ThreadWasViewed $event)
 {
     $this->throttle();
     if (!$this->isThreadViewed($event->thread)) {
         $event->thread->timestamps = false;
         $event->thread->increment('view_count');
         $this->markThreadViewed($event->thread);
     }
     $user = Utils::getCurrentUser();
     if (!is_null($user)) {
         $event->thread->markAsRead($user->id);
     }
 }
Пример #2
0
 public function postEditPost($threadID, $threadAlias, $postID)
 {
     $user = Utils::getCurrentUser();
     $this->load(['thread' => $threadID, 'post' => $postID]);
     $post_valid = Validation::check('post');
     if ($post_valid) {
         $post = array('id' => $postID, 'parent_thread' => $threadID, 'author_id' => $user->id, 'content' => Input::get('content'));
         $post = $this->posts->update($post);
         Alerts::add('success', trans('forum::base.post_updated'));
         return Redirect::to($post->route);
     } else {
         return Redirect::to($this->collections['post']->editRoute)->withInput();
     }
 }
Пример #3
0
 public function getUserReadStatusAttribute()
 {
     if (!$this->old && !is_null(Utils::getCurrentUser())) {
         if (is_null($this->reader)) {
             return self::STATUS_UNREAD;
         }
         return $this->updatedSince($this->reader) ? self::STATUS_UPDATED : false;
     }
     return false;
 }