/**
  * Display a listing of the resource.
  *
  * @param Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $this->validate($request, ['page' => 'integer|min:1', 's' => 'integer|min:1']);
     $s = (int) $request->get('s');
     $query = Department::query();
     $total = $query->count();
     if (empty($s) && empty($request->get('page'))) {
         $s = $total;
     }
     return $query->paginate($s);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $departments = Department::query()->orderBy('name', 'asc')->get();
     return view('departments.index', compact('departments'));
 }