Ejemplo n.º 1
0
 public function doCreateServiceRequest(CreateServiceRequestRequest $request)
 {
     $serviceRequest = new AMServiceRequest();
     $serviceRequest->am_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 declinePendingServiceRequest($id)
 {
     $serviceRequest = AMServiceRequest::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 getAMPendingServicesRequests()
 {
     $serviceRequests = AMServiceRequest::pending()->get();
     return count($serviceRequests);
 }