public function userAuth(Request $request, GenericResponse $response) { $email = $request->get('email'); $apartment_id = $request->get('apartment_id'); $maintenanceRequests = MaintenanceRequest\MaintenanceRequest::with('comments')->with('apartment')->with('photo')->where('apartment_id', '=', $apartment_id)->where('email', '=', $email)->get(); if (count($maintenanceRequests) > 0) { $response->payload->maintenanceRequests = $maintenanceRequests; } else { $response->fails = true; $response->messages = ['auth' => 'Maintenance Request Not Found']; } return $response->json(); }
public function show($id) { $maintenanceRequest = MaintenanceRequest\MaintenanceRequest::with('comments')->with('photo')->find($id); return $maintenanceRequest; }