<?php
	namespace App\Http\Model;
	use Illuminate\Database\Eloquent\Model;
	use DB;
	use Auth;
	class LoanSettingsModel extends Model
	{
		public function BranchPermission($id)
	 	{
		    $QModules=DB::table('modules')->select('Mid')->where('mUrl',$id['url'])->first();
			$Mid=$QModules->Mid;
			return $Qpermission=DB::table('permission')->where('Mid',$Mid)->first();
		}		
		public function viewloantypes()
		{
			return DB::table('ltyp_loantypes')
			//->leftjoin('br_branch','br_branch.br_id','=','lacc_loanaccount.br_id')
			->where('ltyp_status','<>','Deleted')
			->get();
		}
		public function updateMasterLoan($id)
		{
		
		    $status=$id['subb5'];
			if($status=='true')
			{
		       $sts="Active";
			}
			else
			{
		       $sts="Inactive";
			}
			return DB::table('lpf_loanprocessingfee')->where('lpf_id','=',$id['loanid'])->update(['lpf_famt'=>$id['subb1'],'lpf_tamt'=>$id['subb2'],'lpf_amttype'=>$id['subb4'],'lpf_amt'=>$id['subb3'],'lpf_status'=>$sts]);
			
		}
	}