本文整理匯總了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;
}