public function getAppliedJobs($user_id, $status_id, $job_ids = [], $with_banned_jobs = false) { try { $applied_jobs = CompanyApplyJob::with('job_details', 'job_details.company', 'user_details')->where('user_id', '=', $user_id)->where('status', '=', $status_id); if ($with_banned_jobs) { $applied_jobs->whereNotIn('job_id', $job_ids); } return $applied_jobs->get()->toArray(); } catch (Exception $e) { return Response::json(['error' => $e->getMessage()]); } }
public function getAppliedAttribute() { if (Session::has('user_id')) { return CompanyApplyJob::where('job_id', '=', $this->id)->where('user_id', '=', Session::get('user_id'))->whereNotIn('status', [1, 2])->count(); } return 0; }
public function getDailyJobPostApplicants($job_id) { $date_lists = $this->getDateLists($job_id); $dates = CompanyApplyJob::select(DB::raw('DATE(created_at) as created_date'), DB::raw('COUNT(*) as count'))->where('job_id', '=', $job_id)->groupBy('created_date')->get()->toArray(); return $this->processDates($date_lists, $dates); }