public function getJobPost(CompanyService $company, UserService $user, $user_id, $company_id, $job_id) { try { $employer_status = Request::get('employer'); if (Request::has('employer') && !$employer_status || Request::has('user_id')) { $which_user_id = Request::has('user_id') ? Request::get('user_id') : $user_id; Session::put('user_id', $which_user_id); $user->viewJobId($which_user_id, $job_id); } $response = $company->getJobPostById($job_id); if ($response) { return $this->json_response->success($response); if (Request::has('employer') && !$employer_status) { Session::forget('user_id'); } } return $this->json_response->error($response); } catch (Exception $e) { return $this->json_response->error(['error' => $e->getMessage()]); } }