/** * Display a listing of the resource. * * @return Response */ public function index() { $query = Project::orderBy("created_at", "desc"); $paginate = new PaginateService($query); $this->data->projects = $paginate->data(); $this->data->paging = $paginate->paging(); if (Request::ajax()) { return $this->json(); } return $this->view(); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $query = Location::orderBy("name"); $paginate = new PaginateService($query); $this->data->locations = $paginate->data(); $this->data->paging = $paginate->paging(); if (Request::ajax()) { return $this->json(); } return $this->view(); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $this->data->user = $this->user; if ($this->user->isAdmin()) { $query = Club::orderBy("created_at", "desc"); } else { $query = Club::whereClientId($this->user->id)->orderBy("created_at", "desc"); } $paginate = new PaginateService($query); $this->data->clubs = $paginate->data(); $this->data->paging = $paginate->paging(); return $this->json(); }