public function unreadMessagesCount() { return Message::where('to_user_id', $this->id)->where('read', 0)->count(); }
/** * @param $id */ public function markAsUnread($id) { $message = Message::findOrFail($id); $message->read = 0; $message->save(); return \Redirect::route('message.index'); }