<?php namespace App\Models;

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

class asignaciondeact extends Sximo  {
	
	protected $table = 'calendar';
	protected $primaryKey = 'id';

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

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

	public static function queryWhere(  ){
	    
	     $id = Auth::id();

		$dbcon = 0;
		$sql = \DB::table('tb_users')->where('id',$id)->get();
		if(count($sql)){
			$row = $sql[0];
			$Email =$row->email;
			$Group = $row->group_id;
		}	  
	    
	    
	    if($Group =='4') {
		
		return "  WHERE calendar.id IS NOT NULL AND calendar.tipomodulo='Programacion' AND calendar.Asignado='$Email'";
		
	    }else{
	        
	    	return "  WHERE calendar.id IS NOT NULL AND calendar.tipomodulo='Programacion'";    
	        
	    }
		
		
		
	}
	
	public static function queryGroup(){
		return "  ";
	}
	

}
