本文整理汇总了PHP中app\Item::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::paginate方法的具体用法?PHP Item::paginate怎么用?PHP Item::paginate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Item
的用法示例。
在下文中一共展示了Item::paginate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$input = $request->all();
if ($request->get('search')) {
$items = Item::where("title", "LIKE", "%{$request->get('search')}%")->paginate(5);
} else {
$items = Item::paginate(5);
}
return response($items);
}
开发者ID:savanihd,项目名称:Laravel-5-Angularjs-CRUD-with-Search-and-Pagination,代码行数:15,代码来源:ItemController.php
示例2: displayItems
public function displayItems()
{
$itemlist = Item::paginate(10);
$catt = ItemCategory::all();
$categories = ItemCategory::all();
$categories_pack = [];
foreach ($categories as $category) {
$subcategories = ItemSubcategory::where('parent', $category->id)->lists('name');
$categories_pack[$category->id] = $subcategories;
}
$jsonified = json_encode($categories_pack);
$data = ['categories' => $jsonified];
$uoms = Uom::all();
$inventory_types = InventoryType::all();
return view('operations/show', $data, compact('inventory_types', 'itemlist', 'displaycategory', 'displaysubcategory', 'catt', 'uoms'));
}
示例3: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$items = Item::paginate(10);
return view('items.index', compact('items'));
}
示例4: index
public function index()
{
$items = Item::paginate(10);
return $items;
}