Ejemplo n.º 1
0
 /**
  * Get all doctors of the department.
  *
  * @param Request    $request
  * @param Department $department
  *
  * @return string
  */
 public function getDoctors(Request $request, Department $department)
 {
     $this->validate($request, ['page' => 'integer|min:1', 's' => 'integer|min:1']);
     $s = (int) $request->get('s');
     $query = $department->doctors();
     $total = $query->count();
     if (empty($s) && empty($request->get('page'))) {
         $s = $total;
     }
     return $query->paginate($s);
 }