<?php
	
	namespace App\Http\Model;
	use Illuminate\Database\Eloquent\Model;
	use DB;
	use Auth;
	class ModuleModel extends Model
	{
		public function createMod($id)
		{
			return $modules=DB::table('modules')->insertGetId(['Modulename'=>$id['Val1'],'mUrl'=>$id['Val2'],'Mclass'=>$id['Val3'],'Micon'=>$id['Val4'],'Micon1'=>$id['Val4'],'Mstatus'=>'True']);
		}
		
		public function permission()
		{
			return $permission=DB::table('permission')
			->leftjoin('modules','modules.Mid','=','permission.Mid')
			->leftjoin('ut_usertype','ut_usertype.ut_id','=','permission.UsrId')
			->get();
		}
		public function Viewpermision($id)
		{
			return DB::table('permission')->where('Pid',$id['Pid'])->update(['View'=>$id['val']]);
		}
		public function Crreatepermision($id)
		{
			return DB::table('permission')->where('Pid',$id['Pid'])->update(['create'=>$id['val']]);
		}
		public function Editpermision($id)
		{
			return DB::table('permission')->where('Pid',$id['Pid'])->update(['Edit'=>$id['val']]);
		}
		public function Deletepermision($id)
		{
			return DB::table('permission')->where('Pid',$id['Pid'])->update(['Delete'=>$id['val']]);
		}
	 }

