<?php namespace App\Models;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;

class workplaceaccidents extends Sximo  {
	
	protected $table = 'act_sinisters';
	protected $primaryKey = 'id';

	public function __construct() {
		parent::__construct();
		
	}

	public static function querySelect(  ){
		
		return " SELECT act_sinisters.* FROM act_sinisters ";
	}	

	public static function queryWhere(  ){
		
		if(session('gid') == 4)
			return " WHERE act_sinisters.id IS NOT NULL AND act_sinisters.account_id ='".session('aid')."'";
		elseif (session('gid') == 5)
			return " WHERE act_sinisters.id IS NOT NULL AND act_sinisters.account_id ='".session('aid')."' AND act_sinisters.subaccount_id ='".session('sai')."'";
		elseif (session('gid') == 6)
			return " WHERE act_sinisters.id IS NOT NULL AND act_sinisters.account_id ='".session('aid')."' AND act_sinisters.subaccount_id ='".session('sai')."' AND act_sinisters.department_id ='".session('did')."'";
		elseif (session('gid') == 11)
			return "    LEFT OUTER JOIN sc_users_accounts 
                        ON sc_users_accounts.account_id = act_sinisters.account_id 
                        WHERE act_sinisters.id IS NOT NULL AND sc_users_accounts.user_id = '".session('uid')."'";
		else
			return " WHERE act_sinisters.id IS NOT NULL ";
	}
	
	public static function queryGroup(){
		return "  ";
	}
	

}
