Ejemplo n.º 1
0
 /**
  * Shows a message thread
  *
  * @param $id
  * @return mixed
  */
 public function show($id)
 {
     try {
         $thread = Thread::findOrFail($id);
         $thread->getParticipantFromUser(Auth::id());
     } catch (ModelNotFoundException $e) {
         Flash::error('The requested conversation does not exist.');
         return redirect('conversations');
     }
     // show current user in list if not a current participant
     // $users = User::whereNotIn('id', $thread->participantsUserIds())->get();
     // don't show the current user in list
     $userId = Auth::user()->id;
     $users = User::whereNotIn('id', $thread->participantsUserIds($userId))->get();
     $thread->markAsRead($userId);
     return view('core.conversations.show', compact('thread', 'users'));
 }