当前位置: 首页>>代码示例>>PHP>>正文


PHP Product::paginate方法代码示例

本文整理汇总了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());
     }
 }
开发者ID:xenxa,项目名称:essensanaturaleonline,代码行数:8,代码来源:ProductController.php

示例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));
     });
 }
开发者ID:nasikgiga,项目名称:onlineshop,代码行数:14,代码来源:AppServiceProvider.php

示例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);
 }
开发者ID:angelsalazar,项目名称:plazaapp,代码行数:15,代码来源:AdminProductsController.php

示例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
 }
开发者ID:edgarxene,项目名称:ClothingStore,代码行数:15,代码来源:ProductsController.php

示例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'));
 }
开发者ID:huyle2607,项目名称:eCommerce-Laravel-5.1,代码行数:11,代码来源:ProductsController.php

示例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'));
 }
开发者ID:xenxa,项目名称:essensanaturaleonline,代码行数:17,代码来源:HomeController.php

示例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;
 }
开发者ID:ikliko,项目名称:Maxverf,代码行数:18,代码来源:Controller.php

示例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'));
 }
开发者ID:ittamphan,项目名称:EC_12110CLC_GroupF,代码行数:19,代码来源:ProductsController.php

示例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'));
 }
开发者ID:pavhov93,项目名称:laravel_dashboard,代码行数:10,代码来源:ProductsController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $products = Product::paginate(5);
     return view('products.index', compact('products'));
 }
开发者ID:hoangvu2015,项目名称:laravel_totnghiep,代码行数:10,代码来源:ProductController.php

示例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]);
 }
开发者ID:NickMomchev,项目名称:bautech,代码行数:10,代码来源:ProductController.php

示例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'));
 }
开发者ID:JimiOhrid,项目名称:shopStore,代码行数:10,代码来源:ProductsController.php

示例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));
 }
开发者ID:SAMAHM9797,项目名称:LaravelStore,代码行数:5,代码来源:front.php

示例14: produto

 public function produto()
 {
     $products = Product::paginate(16);
     $products->setPath('produtos');
     return view('listaProduto', ['products' => $products]);
 }
开发者ID:EJCM,项目名称:rodalol,代码行数:6,代码来源:ProductController.php

示例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'));
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:11,代码来源:HomeController.php


注:本文中的app\Product::paginate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。