/** * Display a listing of the resource. * * @return View */ public function index() { $search = Request::get('q'); $sortBy = Request::get('sortBy'); $direction = Request::get('direction'); $currentPage = 1; if (Request::get('page')) { $currentPage = Request::get('page'); } $currentRow = $this->maxRowPerPage * ($currentPage - 1); $departments = $this->departments->paginateResults($this->maxRowPerPage, $search, compact('sortBy', 'direction')); $active_departments = $this->departments->totalActive(); $total_departments = $this->departments->total(); return View::make('admin.display.list-departments', ['pageTitle' => 'Manage Department Records'], compact('departments', 'active_departments', 'total_departments', 'search', 'currentRow')); }