SHARE
TWEET

Untitled

a guest Mar 20th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $smartSuitable = Vacancy::
  2.               select(['vacancies.*', 'personal_info.date_of_readiness','personal_info.rank_list_id', \DB::raw("(SELECT MAX(sign_off_date) FROM service WHERE service.user_id = '$user_id' AND service.rank_list_id = personal_info.rank_list_id)")])
  3.             ->join('personal_info', function($join)use($user_id){
  4.                 $join->on("personal_info.user_id" ,"=",\DB::raw("'{$user_id}'"));
  5.             })
  6.            ->join('service', function($join)use($user_id){
  7.                 $join->on("service.user_id" ,"=",\DB::raw("'{$user_id}'"));
  8.                 $join->on("service.rank_list_id" ,"=","personal_info.rank_list_id");
  9.             })
  10.             ->whereRaw('(personal_info.rank_list_id = vacancies.rank_list_id OR service.rank_list_id = vacancies.rank_list_id)')
  11.             ->where('date_of_readiness', '<', 'vacancies.join_date')
  12.             ->whereRaw('salary_expected <= vacancies.salary_max')
  13.             ->where('vacancies.is_smart' , 1)
  14.                     ->whereRaw('(YEAR(CURRENT_DATE) - YEAR(personal_info.date_of_birth)) > vacancies.years_old_min')
  15.                     ->whereRaw('(YEAR(CURRENT_DATE) - YEAR(personal_info.date_of_birth)) < vacancies.years_old_max')
  16.                     ->whereRaw('personal_info.english_proficiency >= vacancies.english_level')
  17.             ->groupBy('vacancies.id')->get();
  18.             return $smartSuitable;
RAW Paste Data
Top