本文整理汇总了PHP中model::getByPage方法的典型用法代码示例。如果您正苦于以下问题:PHP model::getByPage方法的具体用法?PHP model::getByPage怎么用?PHP model::getByPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::getByPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndexByParent
/**
* 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);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$page = Input::get('page', 1);
$limit = Input::get('limit', 10);
$sortBy = Input::get('sortBy', 'sort_order');
$sortDirection = Input::get('sortDirection', 'asc');
$all = Input::get('all', false);
if (!$all) {
$data = $this->model->getByPage($page, $limit, $sortBy, $sortDirection, []);
} else {
// Grab all the contacts
$data = $this->model->getAll($sortBy, $sortDirection);
}
return Response::json($data);
}