Ejemplo n.º 1
0
 public function doCreateServiceRequest(CreateServiceRequestRequest $request)
 {
     $serviceRequest = new SMServiceRequest();
     $serviceRequest->sm_id = \Auth::user()->id;
     $serviceRequest->month = $request->month . '-' . $request->year;
     $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();
     }
 }
Ejemplo n.º 2
0
 public function getSMPendingServicesRequests()
 {
     $serviceRequests = SMServiceRequest::pending()->get();
     return count($serviceRequests);
 }