<?php
	namespace App\Http\Controllers;
	use Illuminate\Foundation\Bus\DispatchesJobs;
	use Illuminate\Routing\Controller as BaseController;
	use Illuminate\Foundation\Validation\ValidatesRequests;
	use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
	use Illuminate\Foundation\Auth\Access\AuthorizesResources;
	use Illuminate\Http\Request;
	use DB;
	use App\Http\Model\PaymentNoticeModel;
	use Validator;
	use File;
	
	class PaymentNoticeController extends Controller
	{
		public function __construct()
		{
			$this->PaymentNoticeMod = new PaymentNoticeModel;
		}
		public function LoadpaymentnoticeRecords()
		{
			$data['url']='paymentnotice';
			$Mid=$this->PaymentNoticeMod->PermissionViewer($data);
			$data['delete']= $Mid->Delete;
			$data['edit']= $Mid->Edit;
			$data['create']= $Mid->create;
			$status= 'Deleted';
			return view('Mosque.paymentnotice',compact('data'));
		}
		
		public function uplodPmtNoticeFilCtrl(Request $request)
		{
			$filenm="";
			$filename="";
			//Upload Image starts here			
			if ($request->hasFile('upload_file')) 
			{
				$filenm = $request->file('upload_file');
				$filename = time().'.'.$filenm->getClientOriginalExtension();
				$destinationPath = public_path('/uploadletter');
				$filenm->move($destinationPath, $filename);
			}
			//Upload Image ends here
			$status = "Active";
			$data = array('doc_docfile'=>$filename,'doc_status'=>$status);
			$insertdetails = DB::table('doc_document')->insert($data);
			if (!is_null($insertdetails))
			{
				return response()->json(['status' => '1', 'message' => trans('Document uploaded successfully.'), 'filename' => $filename ]);
			}
			else
			{
				return response()->json(['status' => '0', 'message' => trans('Error in Insertion.. Please Try again..'), 'filename' => $filename]);
			}
		}
		
	}