/** * Is important? * * @return bool */ public function isImportant() { $get = Users::where('conversation_id', $this->conversation_id)->where('user_id', Auth::getUserId())->first(); return $get->is_important == 1; }
/** * Select as important / not * * @param int $id * @param int $is * * @return mixed */ public function important($id, $is) { $users = new Users(); $users->where('conversation_id', $id)->where('user_id', Auth::getUserId())->update(['is_important' => (string) $is]); return \Redirect::to('mail/' . $id); }