本文整理汇总了PHP中app\Product::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::paginate方法的具体用法?PHP Product::paginate怎么用?PHP Product::paginate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Product
的用法示例。
在下文中一共展示了Product::paginate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show(Request $request)
{
$products = Product::paginate(3);
$products->setPath('/');
if ($request->ajax()) {
return Response::json(\View::make('layouts.products')->with(compact('products'))->render());
}
}
示例2: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
view()->composer('_footer', function ($view) {
$view->with('pages', \App\Page::all());
});
view()->composer('errors.404', function ($view) {
$view->with('products', \App\Product::paginate(12));
});
}
示例3: index
/**
* Despliega la lista de productos que se encuentra en nuestra tabla Products
*
* @return \Illuminate\Http\Response
*/
public function index()
{
/* Obtiene todos los records de nuestra tabla products */
/* paginate($ int) permite desplegar cierta cantidad de cantidad de productos, en este caso 10 */
$products = Product::paginate(10);
/* Indiciamos que el URL a usar para la paginación es products (se espera plazaapp/products/?page=1) */
$products->setPath('products');
/* retorna la vista con todos los productos disponibles */
return view('products.index')->with('products', $products);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$categories = array();
foreach (Category::all() as $category) {
$categories[$category->id] = $category->name;
}
$products = Product::paginate(5);
return view('admin.products.index', compact('products'));
//Regresar la variable categories a la vista con todos los datos
}
示例5: showproducts
public function showproducts()
{
$brands_mobile = Brand::where('brand_type', 'LIKE', '%phone%')->get();
$brands_desktop = Brand::where('brand_type', 'LIKE', '%desktop%')->get();
$brands_laptop = Brand::where('brand_type', 'LIKE', '%laptop%')->get();
$brands_camera = Brand::where('brand_type', 'LIKE', '%camera%')->get();
$brands_tv = Brand::where('brand_type', 'LIKE', '%tv%')->get();
$products = Product::paginate(12);
$products->setPath('products');
return view('webcontent/products', compact('products', 'brands_mobile', 'brands_desktop', 'brands_laptop', 'brands_camera', 'brands_tv'));
}
示例6: index
public function index()
{
$cart = Cart::content();
$subtotal = Cart::total();
$shippingfee = $this->shippingfee;
if (!$subtotal) {
$shippingfee = 0;
}
if ($subtotal > 1150) {
$shippingfee = 0;
}
$taxrate = $this->taxrate;
$tax = round($subtotal * $taxrate);
$total = $subtotal + $shippingfee + $tax;
$products = Product::paginate(3);
return view('pages.app')->with(compact('cart', 'subtotal', 'tax', 'shippingfee', 'total', 'products'));
}
示例7: getPageElements
protected function getPageElements($current, $title, $description, $keywords, $categories = false, $products = false, $promo = false, $currentCategory = null, $perPage = 12)
{
$data = ['current' => $current, 'title' => $title, 'description' => $description, 'keywords' => $keywords, 'current_category' => $currentCategory];
if ($categories) {
$data['categories'] = App\ProductsCategory::where('parent_id', '=', 0)->get();
}
if ($products) {
$productsResponse = Product::paginate($perPage);
$products = $productsResponse->getCollection()->all();
$pages = $productsResponse->render();
$data['products'] = $products;
$data['pages'] = $pages;
}
if ($promo) {
$data['promo_products'] = Product::where('on_discount', '<>', 0)->get()->take(3);
}
return $data;
}
示例8: showproducts
public function showproducts()
{
$number_of_items = Cart::content();
// Lấy các sản phẩm có trong cart
$brands_mobile = Brand::where('brand_type', 'LIKE', '%phone%')->get();
// Lấy loại có tên là PHONE
$brands_desktop = Brand::where('brand_type', 'LIKE', '%desktop%')->get();
// Tương tự trên
$brands_laptop = Brand::where('brand_type', 'LIKE', '%laptop%')->get();
// Tương tự trên
$brands_camera = Brand::where('brand_type', 'LIKE', '%camera%')->get();
// Tương tự trên
$brands_tv = Brand::where('brand_type', 'LIKE', '%tv%')->get();
// Tương tự trên
$products = Product::paginate(12);
// Phân trang, 12 sản phẩm một trang
$products->setPath('products');
return view('webcontent/products', compact('products', 'brands_mobile', 'brands_desktop', 'brands_laptop', 'brands_camera', 'brands_tv', 'number_of_items', 'number_of_items'));
}
示例9: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index($page = 5)
{
$products = Product::paginate($page);
return view('cp.products.index', compact('products'));
}
示例10: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$products = Product::paginate(5);
return view('products.index', compact('products'));
}
示例11: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Model $objects)
{
$objects_for_filter = Model::all();
return view('admin.product.list', ['objects' => $objects->paginate(10), 'objects_for_filter' => $objects_for_filter]);
}
示例12: index
/**
* Method for showing all the products stored in the database.
*
* @return \Illuminate\View\View
*/
public function index()
{
$products = Product::paginate(10);
return view('ecomm.admin.products.index', compact('products'));
}
示例13: products
public function products()
{
$products = Product::paginate(9);
return view('products', array('title' => 'Products Listing', 'description' => '', 'page' => 'products', 'brands' => $this->brands, 'categories' => $this->categories, 'products' => $products));
}
示例14: produto
public function produto()
{
$products = Product::paginate(16);
$products->setPath('produtos');
return view('listaProduto', ['products' => $products]);
}
示例15: showAllCategories
/**
* Show all categories
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showAllCategories()
{
$products = Product::paginate(35);
$category = null;
return view('categories.show', compact('products', 'category'));
}