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


PHP Product::all方法代码示例

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


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

示例1: products

 public function products()
 {
     if (!\Session::get('user')->can('产品查看')) {
         abort(401);
     }
     return view('products/index', ['products' => Product::all()]);
 }
开发者ID:genee-projects,项目名称:snail,代码行数:7,代码来源:ProductController.php

示例2: index

 public function index()
 {
     $products = Product::all();
     $users = User::all();
     return view('admin.admin')->with(['users' => $users, 'products' => $products]);
     //return view('admin.test');
 }
开发者ID:mucyomiller,项目名称:market,代码行数:7,代码来源:AdminController.php

示例3: dashboard

 /**
  * Dashboard Details
  *
  *
  */
 public function dashboard()
 {
     $products = Product::all()->count();
     $orders = Order::all()->count();
     $users = User::all()->count();
     return view('admin.dashboard', compact('products', 'orders', 'users'));
 }
开发者ID:hafizzain,项目名称:mei-project,代码行数:12,代码来源:MeiController.php

示例4: index

 /**
  * Index page
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $productsCount = Product::all()->count();
     $categoriesCount = Category::all()->count();
     $usersCount = User::all()->count();
     return view('manage.index', compact('productsCount', 'categoriesCount', 'usersCount'));
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:12,代码来源:ManageController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $employee_ids = Employee::all()->lists('id')->toArray();
     $order_states = OrderState::lists('id')->toArray();
     $products = Product::all();
     $municipalities = Municipality::all();
     factory(App\Customer::class, 50)->create()->each(function ($customer) use($employee_ids, $products, $municipalities, $order_states) {
         shuffle($employee_ids);
         shuffle($order_states);
         $customer->user()->save(factory(User::class, 'customer')->create());
         $customer->city_id = $municipalities->shuffle()->first()->id;
         $customer->save();
         $customer->products()->attach($products->shuffle()->first(), ['vote' => rand(1, 5), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
         $customer->orders()->save(factory(App\Order::class)->create(['acquired_by' => $employee_ids[0], 'state_id' => $order_states[0]]));
     });
     $user = new User();
     $user->name = 'Vid';
     $user->surname = 'Mahovic';
     $user->email = 'vid.mahovic@gmail.com';
     $user->password = 'vid123';
     $user->verified = true;
     $user->save();
     $customer = new Customer();
     $customer->street = 'Celovška 21';
     $customer->city_id = $municipalities->shuffle()->first()->id;
     $customer->phone = '+38640850993';
     $customer->save();
     $customer->user()->save($user);
 }
开发者ID:vidmahovic,项目名称:ep-store,代码行数:34,代码来源:CustomersTableSeeder.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $products = Product::all();
     /*return view('products.index')
       ->with('products', $products);*/
     return $products;
 }
开发者ID:SigurdMW,项目名称:learning-laravel-5,代码行数:12,代码来源:ProductController.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Suppression préalable des fichiers de upload par l'utilisation de la variable storage définie à l'aide de l'instruction public_path('upload') du fichier de configuration config\filesystem.php)
     $files = Storage::allFiles();
     //retroune un tableau des images de storage
     foreach ($files as $file) {
         Storage::delete($file);
     }
     //Supprimer toutes les lignes de la talble Pictures
     //        DB::table('pictures')->
     // Récupération d'un faker opétationnel
     // $faker = Faker\Factory::create();
     $products = Product::all();
     foreach ($products as $product) {
         // Stokage de l'image et récupération de l'uri
         $uri = str_random(15) . '_370x235.jpg';
         Storage::put($uri, file_get_contents('http://lorempixel.com/people/370/325/'));
         Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->faker->name]);
     }
     //        DB::table('pictures')->insert(
     //            [
     //                [
     //                    'product_id'  => '2' ,
     //                    'uri'         => $uri
     //                ],
     //            ]
     //        );
 }
开发者ID:lionel-kahan,项目名称:Star-Wars,代码行数:33,代码来源:PictureTableSeeder.php

示例8: productList

 public function productList()
 {
     $message = \Session::get('message');
     $list = \App\Product::all();
     $dimensions = Arrays::dimensionNames();
     return view('admin.list', compact('list', 'dimensions', 'message'));
 }
开发者ID:Qeenslet,项目名称:wireworks,代码行数:7,代码来源:HomeController.php

示例9: home

 public function home()
 {
     $products = Product::all();
     $categories = Categorie::all();
     //dump($products);
     return view('accueil', ["produit" => $products, "category" => $categories]);
 }
开发者ID:VikyV,项目名称:laraveltest,代码行数:7,代码来源:MainController.php

示例10: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $products = Product::all();
     $countInactive = 0;
     $countDeleted = 0;
     $arrProductsIna = [];
     $arrProductsDel = [];
     foreach ($products as $product) {
         $differenceDays = $product->created_at->diffInDays(Carbon::now());
         if ($differenceDays >= 30 && $product->published != 0) {
             $product->published = 0;
             $product->save();
             $countInactive++;
             $arrProductsIna[] = $product->name;
         }
         /*if($differenceDays >= 60 && $product->published == 0)
           {
               $arrProductsDel[]= $product->name;
               $this->productRepository->destroy($product->id);
               $countDeleted++;
           }*/
     }
     $this->info('Done, ' . $countInactive . ' Inactive Products - ' . $countDeleted . ' Delete Products');
     try {
         $this->mailer->infoProductsInnactive(['productsIna' => $arrProductsIna, 'productsDel' => $arrProductsDel, 'innactives' => $countInactive, 'deleted' => $countDeleted]);
     } catch (Swift_RfcComplianceException $e) {
         Log::error($e->getMessage());
     }
 }
开发者ID:alons182,项目名称:guanacastevende,代码行数:34,代码来源:CheckDays.php

示例11: index

 public function index()
 {
     $products = \App\Product::all();
     // $products = \App\Product::where('price','<','10.00')->get();
     $mostPopularProducts = [];
     return view('products', compact('products', 'mostPopularProducts'));
 }
开发者ID:tiggerbaby,项目名称:testing-laravel,代码行数:7,代码来源:ProductsController.php

示例12: index

 public function index()
 {
     $products = Product::all();
     $productCode = Product::limit(1)->orderBy('product_code', 'decs')->first();
     if (isset($productCode->product_code)) {
         $crop = substr($productCode->product_code, 4);
         if ($crop < 9) {
             $plus = $crop + 1;
             $urutan = "JOR000" . $plus;
         } elseif ($crop < 99) {
             $plus = $crop + 1;
             $urutan = "JOR00" . $plus;
         } elseif ($crop < 999) {
             $plus = $crop + 1;
             $urutan = "JOR0" . $plus;
         } elseif ($crop < 9999) {
             $plus = $crop + 1;
             $urutan = "JOR" . $plus;
         } elseif ($crop >= 9999) {
             $urutan = "ERROR";
         }
     } else {
         $urutan = "JOR0001";
     }
     // return response()->json(array('data' => $products, 'urutan' => $urutan));
     return view('admin.product')->withProducts($products)->withUrutans($urutan);
 }
开发者ID:sholihin,项目名称:ecommerce,代码行数:27,代码来源:ProductController.php

示例13: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $statuses = Status::all();
     $products = Product::all();
     $productionschedule = Batch::find($id);
     return view('production.edit', ['productionschedule' => $productionschedule, 'products' => $products, 'statuses' => $statuses]);
 }
开发者ID:samyerkes,项目名称:sweet.com,代码行数:13,代码来源:ProductionController.php

示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $products = Product::all();
     foreach ($products as $p) {
         $p->slug = Str::slug($p->name);
         $p->save();
     }
 }
开发者ID:shirkkan,项目名称:shop-core,代码行数:13,代码来源:SlugSeeder.php

示例15: 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:berkapavel,项目名称:Laravel-ecom,代码行数:8,代码来源:ProductsController.php


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