/** * Show a list of all contacts * * @return View */ public function getIndex() { // Title $title = 'Boite de réception'; try { $page = Input::get('page', 1); $limit = Input::get('limit', 10); $sortBy = Input::get('sortBy', 'created_at'); $sortDirection = Input::get('sortDirection', 'desc'); $data = $this->model->getByPage($page, $limit, $sortBy, $sortDirection, []); $totalItems = $data->totalItems; $limit = $data->limit; $models = new Paginator($data->items, $data->totalItems, $data->limit, $page, ['path' => Paginator::resolveCurrentPath()]); } catch (RequestException $e) { echo $e->getRequest() . "\n"; if ($e->hasResponse()) { echo $e->getResponse() . "\n"; } exit; } JavaScript::put(['locale' => LaravelLocalization::setLocale(), 'collection' => $models->getcollection()->toJson()]); $data = array('title' => $title, 'models' => $models, 'modelBreacrumbs' => '', 'totalItems' => $totalItems, 'limit' => $limit, 'sortBy' => $sortBy, 'sortDirection' => $sortDirection, 'routes' => array('create' => 'admin/contacts/create', 'export' => 'admin/contacts/export')); // Show the page return View::make('admin.index', $data); }