本文整理汇总了PHP中Illuminate\Pagination\LengthAwarePaginator::getcollection方法的典型用法代码示例。如果您正苦于以下问题:PHP LengthAwarePaginator::getcollection方法的具体用法?PHP LengthAwarePaginator::getcollection怎么用?PHP LengthAwarePaginator::getcollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Pagination\LengthAwarePaginator
的用法示例。
在下文中一共展示了LengthAwarePaginator::getcollection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
/**
* 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);
}