public function getBookmarkedAttribute() { if (Session::has('user_id')) { $user_id = Session::get('user_id'); $user = BookMarkJob::where('user_id', '=', $user_id)->where('job_id', '=', $this->id)->first(); if (count($user) > 0) { return $user; } return []; } return []; }
public function getbookMarkedJobs($user_id) { try { return BookMarkJob::where('user_id', '=', $user_id)->lists('job_id'); } catch (Exception $e) { return Response::json(['error' => $e->getMessage()]); } }