Ejemplo n.º 1
0
 public function getMRPendingServicesRequests()
 {
     $serviceRequests = ServiceRequest::pending()->get();
     return count($serviceRequests);
 }
Ejemplo n.º 2
0
 public function declinePendingServiceRequest($id)
 {
     $serviceRequest = ServiceRequest::findOrFail($id);
     $serviceRequest->approved = 0;
     try {
         $serviceRequest->save();
         return redirect()->back()->with('message', 'Service Request has been declined successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to decline service request , with error message: ' . $ex->getMessage();
     }
 }
Ejemplo n.º 3
0
 public function doCreateServiceRequest(CreateServiceRequestRequest $request)
 {
     $serviceRequest = new ServiceRequest();
     $serviceRequest->mr_id = \Auth::user()->id;
     $serviceRequest->month = $request->month . '-' . date('Y');
     $serviceRequest->date = $request->date;
     $serviceRequest->request_text = $request->request_text;
     try {
         $serviceRequest->save();
         return redirect()->back()->with('message', 'Service Request has been sent to your managers successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to create new service request , with error message: ' . $ex->getMessage();
     }
 }