/** * Show a list of all contacts By Parent * * @return View */ public function getIndexByParent($parent_id) { // Title $title = 'Boite de réception'; try { $page = Input::get('page', 1); $limit = Input::get('limit', 10); $sortBy = Input::get('sortBy', 'sort_order'); $sortDirection = Input::get('sortDirection', 'desc'); $data = $this->model->getByPage($page, $limit, $sortBy, $sortDirection, []); $totalItems = $data->totalItems; $limit = $data->limit; $models = Paginator::make($data->items, $data->totalItems, $data->limit); } 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, 'totalItems' => $totalItems, 'limit' => $limit, 'sortBy' => $sortBy, 'sortDirection' => $sortDirection, 'routes' => array('create' => 'admin/contacts/create')); // Show the page return View::make('admin.index', $data); }