<?php namespace App\Models\Admin;

use App\Models\Project\DatatableModel;

class Career_applicationModel extends AdminModel{
	private $table;
	
    public function __construct(){
		parent::__construct();
		$this->table = "career_application";
    }
	
	public function get_datatable(){
		$dtObj = new DatatableModel($this->db);
		$dtObj->set_table($this->table);
		// Set Datatable columns 
		$dtObj->set_column('career_application_id ', 'desc', 'RecordID');
		$dtObj->set_column('name', 'sort|search');
		$dtObj->set_column('added_date', 'sort|search|date');
		$dtObj->set_column('status', 'sort|search');
		$builder = $dtObj->get_builder();
		$builder->where('is_deleted','No');
		return $dtObj->get_data($builder);
	}
	
	public function get($career_application_id){
		$builder = $this->db->table($this->table." AS ca");
		$query = $builder->join('career AS c',"ca.career_id=c.career_id",'inner')
			->select('ca.*,c.title AS post_title')
			->where('career_application_id',$career_application_id)->get();
		return $query->getRowArray();
	}
	public function get_application_title($career_application_id){
		$builder =$this->db->table('career');
		$query = $builder->where('career_id',$career_application_id)->get();
		return $query->getRowArray();
	}
}