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


PHP Product::all方法代码示例

本文整理汇总了PHP中Product::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::all方法的具体用法?PHP Product::all怎么用?PHP Product::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Product的用法示例。


在下文中一共展示了Product::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 /**
  * Display the specified dashboard.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $products = Product::all();
     $records = Record::all();
     $manufacturers = Manufacturer::all();
     return View::make('Dashboard.index', compact('records', 'products', 'manufacturers'));
 }
开发者ID:hunt-son,项目名称:inventory-app-2,代码行数:13,代码来源:DashboardsController.php

示例2: run

 public function run()
 {
     $this->trancate();
     $faker = Faker\Factory::create();
     $languages = Language::all();
     $products = Product::all();
     $attributes = Attribute::all();
     $attributes_options = array();
     foreach ($languages as $language) {
         $options = DB::table('attributes_options')->whereLanguageId($language->id)->get();
         $options = new Illuminate\Database\Eloquent\Collection($options);
         $options = $options->lists("options", 'attribute_id');
         $attributes_options[$language->id] = $options;
     }
     $attributes_key = $attributes->modelKeys();
     $products->each(function ($product) use($attributes_key, $languages, $faker, $attributes_options) {
         $count_to_insert = rand(0, rand(0, count($attributes_key) - 1));
         for ($i = 1; $i <= $count_to_insert; $i++) {
             foreach ($languages as $language) {
                 $attribute_id = $attributes_key[rand(0, count($attributes_key) - 1)];
                 $options = $attributes_options[$language->id][$attribute_id];
                 $tokens = explode("|", $options);
                 try {
                     DB::table('products_to_attributes')->insert(array('product_id' => $product->id, 'language_id' => $language->id, 'attribute_id' => $attribute_id, 'value' => $tokens[rand(0, count($tokens) - 1)]));
                 } catch (Exception $x) {
                     var_dump($x);
                 }
             }
         }
     });
 }
开发者ID:pda-code,项目名称:eshop-angular-laravel,代码行数:31,代码来源:Products_Attributes_Seeder.php

示例3: getIndex

 public function getIndex()
 {
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return View::make('products.index')->with('products', Product::all())->with('categories', $categories);
 }
开发者ID:tiansial,项目名称:laravel-ecommerce,代码行数:8,代码来源:ProductsController.php

示例4: dataTables

 public function dataTables()
 {
     return Datatable::collection(Product::all())->showColumns("id", "name", "identifier", "category", "import", "source_area", "brand", "price", "desc", "created_at")->addColumn('products_category', function ($model) {
         return Category::where('parent_code', 'PRODUCT_CATEGORY')->where('code', $model->category)->select('name as label', 'code as value')->first();
     })->addSelect('products_category', function () {
         return Category::where('parent_code', 'PRODUCT_CATEGORY')->select('name as label', 'code as value')->get();
     })->searchColumns(array('name'))->orderColumns('created_at')->setAliasMapping()->make();
 }
开发者ID:Kangaroos,项目名称:oneshike,代码行数:8,代码来源:ProductController.php

示例5: products

 public function products()
 {
     $ids2 = DB::table('tblProducts')->select('strProdID')->orderBy('updated_at', 'desc')->orderBy('strProdID', 'desc')->take(1)->get();
     $ID2 = $ids2["0"]->strProdID;
     $newID2 = $this->smart($ID2);
     // Get all products from the database
     $products = Product::all();
     return View::make('products')->with('products', $products)->with('newID2', $newID2);
 }
开发者ID:ExperimentalGroup,项目名称:inventoryfinal,代码行数:9,代码来源:HomeController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $all = Product::all();
     $op = array();
     foreach ($all as $data) {
         $op[] = array("{$data->id}", $data->product_name, "{$data->bike_cc}", $data->model, "action");
     }
     return json_encode(array("data" => $op));
 }
开发者ID:rana7cse,项目名称:motoshop,代码行数:14,代码来源:ProductController.php

示例7: display

 public function display()
 {
     $products = Product::all();
     $products = Product::orderBy('p_id', 'desc')->paginate(3);
     $users = User::all();
     $users = User::orderBy('id', 'desc')->paginate(3);
     $suppliers = Product::lists('supplier', 'supplier');
     $metals = Product::lists('metal', 'metal');
     return View::make('products.list')->with('products', $products)->with('suppliers', $suppliers)->with('metals', $metals)->with('users', $users);
 }
开发者ID:ArbindJain,项目名称:scrapkart,代码行数:10,代码来源:ProductsController.php

示例8: getView

 public function getView($id)
 {
     $product = Product::find($id);
     if ($product) {
         $random = Product::all()->random(4);
         return View::make('store.view')->with('product', $product)->with('random', $random);
     } else {
         return View::make('404');
     }
 }
开发者ID:Manthan787,项目名称:astitvastore,代码行数:10,代码来源:StoreController.php

示例9: getHome

 public function getHome()
 {
     $products = Product::all();
     if (Auth::check()) {
         $user = Auth::user();
     } else {
         $user = new User();
         $user->first_name = 'stranger';
     }
     return View::make('home', array('products' => $products, 'user' => $user));
 }
开发者ID:V3ronique,项目名称:SingaporeAuction,代码行数:11,代码来源:HomeController.php

示例10: getProducts

 function getProducts()
 {
     $ProductID = $this->f3->get('PARAMS.ProductID');
     $p = new Product($this->db);
     //$products = $product->all();
     if (isset($ProductID)) {
         $products = $p->getById($ProductID);
     } else {
         $products = $p->all();
     }
     echo $this->utils->successResponse($p, $products);
 }
开发者ID:bandjam,项目名称:site-base,代码行数:12,代码来源:PublicController.php

示例11: run

 public function run()
 {
     $this->trancate();
     $languages = Language::all();
     $products = Product::all();
     $categories = Category::all();
     $categories_array = $categories->toArray();
     $products->each(function ($product) use($categories_array) {
         // product to categories
         DB::table('products_to_categories')->insert(array('product_id' => $product->id, 'category_id' => $categories_array[rand(0, count($categories_array) - 1)]['id']));
     });
 }
开发者ID:pda-code,项目名称:eshop-angular-laravel,代码行数:12,代码来源:Products_Categories_Seeder.php

示例12: index

 public function index()
 {
     // Check if user has sent a search query
     if ($query = Input::get('query', false)) {
         // Use the Elasticquent search method to search ElasticSearch
         $products = Product::search($query);
     } else {
         // Show all posts if no query is set
         $products = Product::all();
     }
     return View::make('products', compact('products'));
 }
开发者ID:eavillacis,项目名称:example_elasticsearch,代码行数:12,代码来源:ProductsController.php

示例13: run

 public function run()
 {
     $this->trancate();
     $faker = Faker\Factory::create();
     $products = Product::all();
     $products->each(function ($product) use($faker) {
         //product reviews
         $reviews_count = rand(0, 30);
         for ($i = 0; $i < $reviews_count - 1; $i++) {
             DB::table('products_review')->insert(array('product_id' => $product->id, 'author' => $faker->firstName, 'title' => $faker->sentence, 'text' => $faker->text(), 'rating' => rand(1, 5), 'approved' => 1, 'created_at' => \Carbon\Carbon::createFromDate(rand(2012, 2014), rand(1, 12), rand(1, 29))->toDateTimeString(), 'updated_at' => \Carbon\Carbon::createFromDate(rand(2012, 2014), rand(1, 12), rand(1, 29))->toDateTimeString()));
         }
     });
 }
开发者ID:pda-code,项目名称:eshop-angular-laravel,代码行数:13,代码来源:Products_Review_Seeder.php

示例14: get

 public function get($id = null)
 {
     $search = Input::get('search');
     if (!is_null($search)) {
         $adjustments = Adjustment::select('adjustments.*')->join('products', 'products.id', '=', 'adjustments.products_id')->where('products.name', 'like', '%' . $search . '%')->orwhere('products.code', 'like', '%' . $search . '%')->orderBy('adjustments.created_at')->paginate(15);
     } else {
         $adjustments = Adjustment::latest()->paginate(15);
     }
     $selectedAdjustment = self::__checkExistence($id);
     if (!$selectedAdjustment) {
         $selectedAdjustment = new Adjustment();
     }
     $products = Product::all()->lists('name', 'id');
     return View::make('adjustments.main')->with('id', $id)->with('products', $products)->with('search', $search)->with('selectedAdjustment', $selectedAdjustment)->with('adjustments', $adjustments);
 }
开发者ID:frankpaul142,项目名称:cloudinventory,代码行数:15,代码来源:AdjustmentController.php

示例15: dashboard

 public function dashboard()
 {
     if (!Auth::user()->is_admin) {
         return Redirect::to('/');
     }
     //produits de la boutique
     $products = Product::all();
     // récupérer les dates ou il y a eu des commandes donc achats
     $cmds = DB::select(DB::raw('SELECT DATE(orders.date) AS date FROM orders GROUP BY DATE(orders.date) ORDER BY orders.date DESC'));
     //récupérer les achats par date
     $cmdsByDate = array();
     foreach ($cmds as $key => $cmd) {
         $cmdsByDate[$cmd->date] = Orderitem::whereRaw('DATE(orders.date) = \'' . $cmd->date . '\'')->leftJoin('orders', 'order_items.order_id', '=', 'orders.id')->leftJoin('users', 'orders.user_id', '=', 'users.id')->leftJoin('products', 'order_items.item_id', '=', 'products.id')->select('order_items.*', 'orders.date AS date', 'users.email AS user_email', 'users.first_name AS user_first', 'users.last_name AS user_last', 'products.name AS item_name')->orderBy('orders.date', 'DESC')->get();
     }
     //list des commandes par mois
     return View::make('admin/show', array('products' => $products, 'cmdsbydate' => $cmdsByDate));
 }
开发者ID:spark942,项目名称:supinternet-projects,代码行数:17,代码来源:AdminController.php


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