public function index() { $lists = Addressbook::getAddressbooks($this->paginate, $this->orderBy); $listsHtml = Jamesy\Addressbooks::getListsHtml($lists); $orderBy = 1; switch ($this->orderBy) { case ['id', 'asc']: $orderBy = 1; break; case ['id', 'desc']: $orderBy = 2; break; case ['name', 'asc']: $orderBy = 3; break; case ['name', 'desc']: $orderBy = 4; break; } return View::make('backend.lists.index', ['user' => $this->user, 'isAdmin' => $this->isAdmin, 'configs' => $this->configs, 'listsHtml' => $listsHtml, 'logged_in_for' => $this->logged_in_for, 'activeParent' => $this->activeParent, 'active' => 'alllists', 'records' => $this->paginate, 'orderBy' => $orderBy, 'links' => $lists->links('backend.pagination.nifty')]); }