Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: Gintautas
- * Date: 10/9/2014
- * Time: 11:44 AM
- */
- class JobOffer extends Eloquent{
- protected $table='new_job_offer';
- //For search jobs in index
- public static function search($category, $location, $keyword)
- {
- if($keyword == ""){
- $query = JobOffer::select('new_job_offer.id','new_job_offer.job_title', 'new_job_offer.location_region', 'companies.name')
- ->join('companies', 'new_job_offer.company_id', '=', 'companies.user_id')
- ->where('new_job_offer.job_category', '=', $category)
- ->where('new_job_offer.location_region', '=', $location)
- ->orderBy('new_job_offer.created_at')
- ->paginate(10);
- }else{
- $match = "MATCH( `job_description`,`job_title`) AGAINST (?)";
- $query = JobOffer::select('new_job_offer.id','new_job_offer.job_title', 'new_job_offer.location_region', 'companies.name')
- ->join('companies', 'new_job_offer.company_id', '=', 'companies.user_id')
- ->where('new_job_offer.job_category', '=', $category)
- ->where('new_job_offer.location_region', '=', $location)
- ->whereRaw($match, array($keyword))
- ->orderBy('new_job_offer.created_at')
- ->paginate(10);
- }
- return $query;
- }
- //For search jobs in worker menu
- public static function searchJobsInWorker($category, $location, $keyword)
- {
- $worker_id = Session::get('worker_id');
- if($keyword == ""){
- $query = JobOffer::select('new_job_offer.id','new_job_offer.job_title', 'new_job_offer.location_region', 'companies.name', 'applied_jobs.offer_id' )
- ->join('companies', 'new_job_offer.company_id', '=', 'companies.user_id')
- ->leftJoin('applied_jobs', function($leftJoin)use($worker_id)
- {
- $leftJoin->on('applied_jobs.offer_id', '=', 'new_job_offer.id');
- $leftJoin->on(DB::raw('applied_jobs.worker_id'), DB::raw('='),DB::raw("'".$worker_id."'"));
- })
- ->where('new_job_offer.job_category', '=', $category)
- ->where('new_job_offer.location_region', '=', $location)
- ->orderBy('new_job_offer.created_at')
- ->paginate(10);
- }else{
- $match = "MATCH( `job_description`,`job_title`) AGAINST (?)";
- $query = JobOffer::select('new_job_offer.id','new_job_offer.job_title', 'new_job_offer.location_region', 'companies.name')
- ->leftJoin('applied_jobs', function($leftJoin)use($worker_id)
- {
- $leftJoin->on('applied_jobs.offer_id', '=', 'new_job_offer.id');
- $leftJoin->on(DB::raw('applied_jobs.worker_id'), DB::raw('='),DB::raw("'".$worker_id."'"));
- })
- ->join('companies', 'new_job_offer.company_id', '=', 'companies.user_id')
- ->where('new_job_offer.job_category', '=', $category)
- ->where('new_job_offer.location_region', '=', $location)
- ->whereRaw($match, array($keyword))
- ->orderBy('new_job_offer.created_at')
- ->paginate(10);
- }
- Log::info($query);
- return $query;
- }
- public static function ShowAllJobsOfferInCouruselIndex()
- {
- $query = JobOffer::select('new_job_offer.id','new_job_offer.job_title', 'new_job_offer.location_region', 'companies.name')
- ->join('companies', 'new_job_offer.company_id', '=', 'companies.user_id')
- ->orderBy('new_job_offer.created_at')
- ->get();
- return $query;
- }
- public static function ShowOneJob($id)
- {
- $query = JobOffer::
- join('companies', 'new_job_offer.company_id', '=', 'companies.user_id')
- ->join('users', 'new_job_offer.company_id', '=', 'users.id')
- ->where('new_job_offer.id', '=', $id)
- ->get()->first();
- return $query;
- }
- public static function ShowNewJobOffersInUserSidebar()
- {
- $query = JobOffer::select('new_job_offer.id','new_job_offer.job_title', 'new_job_offer.location_region', 'companies.name')
- ->join('companies', 'new_job_offer.company_id', '=', 'companies.user_id')
- ->orderBy('new_job_offer.created_at', 'desc')
- ->limit(5)
- ->get();
- return $query;
- }
- public static function GetCompanyIdByOfferId($offer_id){
- $query = JobOffer::where('id', '=', $offer_id)
- ->pluck('company_id');
- $result = company::where('user_id', '=', $query)
- ->pluck('id');
- return $result;
- }
- public static function Duration(){
- $duration = array(
- 'Please select',
- '1-2 weeks' => '1-2 weeks',
- '2-4 weeks' => '2-4 weeks',
- '1 month' => '1 month',
- '2 months' => '2 moths',
- '3-4 months' => '3-4 months',
- '5-6 months' => '5-6 months',
- );
- return $duration;
- }
- public static function Experience(){
- $experience = array(
- 'Please select',
- '< 6 months' => '< 6 months',
- '> 6 months' => '> 6 months',
- '1 year' => '1 year' ,
- '2 years' => '2 years' ,
- '> 2 years' => '> 2 years' ,
- '> 5 years' => '> 5 years' ,
- );
- return $experience;
- }
- public static function ContractType(){
- $contract_type = array(
- 'Please select',
- 'Temporary' => 'Temporary',
- 'Permanent' => 'Permanent',
- );
- return $contract_type;
- }
- public static function category(){
- $category = array(
- 'Please select',
- 'Engineers' => array(
- 'CH Engineer' => 'CH Engineer',
- 'Ch. Engineer <3000kW' => 'Ch. Engineer <3000kW',
- '1st Engineer' => '1st Engineer',
- '1st Engineer <3000kW' => '1st Engineer <3000kW',
- '2nd Engineer' => '2nd Engineer',
- '2nd Engineer <3000kW' => '2nd Engineer <3000kW',
- '3rd Engineer' => '3rd Engineer',
- '4th Engineer' => '4th Engineer',
- 'EOOW' => 'EOOW',
- 'ETO' => 'ETO',
- 'Trainee Engineer' => 'Trainee Engineer',
- ),
- 'Officers' =>array(
- 'Captain' => 'Captain',
- 'Captain <3000 gt' => 'Captain <3000 gt',
- 'Ch. Officer' => 'Ch. Officer',
- 'Ch. Officer <300 gt' => 'Ch. Officer <300 gt',
- '2nd Officer' => '2nd Officer',
- '3nd Officer' => '3nd Officer',
- 'OOW' => 'OOW',
- 'Trainee Officer' => 'Trainee Officer',
- ),
- 'Ratings' =>array(
- 'AB' => 'AB',
- 'AB Bosun' => 'AB Bosun',
- 'OS' => 'OS',
- 'Motorman' => 'Motorman',
- 'Oiler' => 'Oiler',
- 'Fitter' => 'Fitter',
- 'Electrician' => 'Electrician',
- 'Welder' => 'Welder',
- 'Pumpman' => 'Pumpman',
- 'Engine Cadet' => 'Engine Cadet',
- 'Deck Cadet' => 'Deck Cadet'
- ),
- 'Catering' =>array(
- 'Steward/ess' => 'Steward/ess',
- 'Cook' => 'Cook',
- 'AB-Cook' => 'AB-Cook',
- 'Other Catering staff' => 'Other Catering staff',
- ),
- 'Other personnel' =>array(
- 'OIM' => 'OIM',
- 'SSL' => 'SSL',
- 'STSL' => 'STSL',
- 'HLO' => 'HLO',
- 'Administrator' => 'Administrator',
- 'Crane Operator' => 'Crane Operator',
- 'Derrickman' => 'Derrickman',
- 'Mud Man' => 'Mud Man',
- 'Forward planner' => 'Forward planner',
- 'Superintendent' => 'Superintendent',
- 'Radio Operator' => 'Radio Operator',
- 'Geologist' => 'Geologist',
- 'Surveyor' => 'Surveyor',
- 'Safety Officer' => 'Safety Officer',
- 'Driller' => 'Driller',
- 'Tool pusher' => 'Tool pusher',
- 'Cementer' => 'Cementer',
- 'Painter' => 'Painter',
- 'Pusher' => 'Pusher',
- 'Rigger' => 'Rigger',
- 'Deck Foreman' => 'Deck Foreman',
- 'Roustabout' => 'Roustabout',
- 'ROV Pilot' => 'ROV Pilot',
- 'ROV Technician' => 'ROV Technician',
- 'ROV Superintedent' => 'ROV Superintedent',
- 'ROV Supervisor' => 'ROV Supervisor'
- ),
- );
- return $category;
- }
- public static function Sector(){
- return array(
- 'Please select',
- 'Offshore' => 'Offshore',
- 'Maritime' => 'Maritime',
- );
- }
- public static function TypeOfVessel(){
- return array(
- 'Please select',
- 'Barge self-propelled' => 'Barge self-propelled',
- 'Barge self-propelled DP' => 'Barge self-propelled DP',
- 'Barge non propelled' => 'Barge non propelled',
- 'Accommodation Vessel' => 'Accommodation Vessel',
- 'Accommodation Vessel DP' => 'Accommodation Vessel DP',
- 'AHTS' => 'AHTS',
- 'AHTS DP' => 'AHTS DP',
- 'Bulker' => 'Bulker',
- 'Cable laying vessel' => 'Cable laying vessel',
- 'Cable laying vessel DP' => 'Cable laying vessel DP',
- 'Chemical/Oil Tanker' => 'Chemical/Oil Tanker',
- 'Container vessel' => 'Container vessel',
- 'Crew transfer vessel' => 'Crew transfer vessel',
- 'Cruise vessel' => 'Cruise vessel',
- 'Dredger' => 'Dredger',
- 'Dredger DP' => 'Dredger DP',
- 'Drillship' => 'Drillship',
- 'DSV' => 'DSV',
- 'DSV DP' => 'DSV DP',
- 'ERRV' => 'ERRV',
- 'ERRV DP' => 'ERRV DP',
- 'Fixed platform' => 'Fixed platform',
- 'FPSO' => 'FPSO',
- 'FSIV' => 'FSIV',
- 'General Cargo' => 'General Cargo',
- 'Heavy lift vessel' => 'Heavy lift vessel',
- 'HSSV' => 'HSSV',
- 'Jack Up non propelled' => 'Jack Up non propelled',
- 'Jack Up self-propelled' => 'Jack Up self-propelled',
- 'Jack Up self-propelled DP' => 'Jack Up self-propelled DP',
- 'LNG carrier' => 'LNG carrier',
- 'LPG carrier' => 'LPG carrier',
- 'OSV' => 'OSV',
- 'OSV DP' => 'OSV DP',
- 'Passenger vessel' => 'Passenger vessel',
- 'Pipe laying vessel' => 'Pipe laying vessel',
- 'Production Platform' => 'Production Platform',
- 'PSV' => 'PSV',
- 'PSV DP' => 'PSV DP',
- 'RO-PAX' => 'RO-PAX',
- 'RO-RO' => 'RO-RO',
- 'ROV' => 'ROV',
- 'Scientific vessel' => 'Scientific vessel',
- 'Seismic vessel' => 'Seismic vessel',
- 'SSV ' => 'SSV ',
- 'SSV DP' => 'SSV DP',
- 'Superyacht' => 'Superyacht',
- 'Tug' => 'Tug',
- );
- }
- public static function Location(){
- return array(
- 'Please select',
- 'Australia' => 'Australia' ,
- 'Antarctica' => 'Antarctica' ,
- 'Arctic' => 'Arctic' ,
- 'Antarctic Ocean'=> 'Antarctic Ocean',
- 'Asia' => 'Asia' ,
- 'Atlantic Ocean' => 'Atlantic Ocean' ,
- 'Caspian Sea' => 'Caspian Sea' ,
- 'Europe' => 'Europe' ,
- 'East Africa' => 'East Africa' ,
- 'Indian Ocean' => 'Indian Ocean' ,
- 'Meditirean Sea' => 'Meditirean Sea' ,
- 'North America' => 'North America' ,
- 'North Sea' => 'North Sea' ,
- 'Pacific Ocean' => 'Pacific Ocean' ,
- 'South America' => 'South America' ,
- 'West Africa' => 'West Africa' ,
- 'World wide' => 'World wide' ,
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement