當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Category::all方法代碼示例

本文整理匯總了PHP中CodeCommerce\Category::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::all方法的具體用法?PHP Category::all怎麽用?PHP Category::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CodeCommerce\Category的用法示例。


在下文中一共展示了Category::all方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tag

 public function tag($id)
 {
     $categories = $this->category->all();
     $tag = $this->tag->find($id);
     $products = $tag->products()->get();
     //dd($products->get());
     return view('store.tag', compact('categories', 'products', 'tag'));
 }
開發者ID:rvieceli,項目名稱:codecommerce,代碼行數:8,代碼來源:StoreController.php

示例2: place_order

 public function place_order(Order $orderModel, OrderItems $orderItems, CheckoutService $checkoutService)
 {
     if (!Session::has('cart')) {
         return false;
     }
     $cart = Session::get('cart');
     $categories = Category::all();
     if ($cart->getTotal() > 0) {
         $order = $orderModel::create(['user_id' => Auth::User()->id, 'total' => $cart->getTotal(), 'status' => '0']);
         foreach ($cart->all() as $id => $item) {
             $order->items()->create(['order_id' => $order->id, 'product_id' => $id, 'price' => $item['price'], 'qtd' => $item['qtd']]);
         }
         $checkout = $checkoutService->createCheckoutBuilder();
         $checkout->setReference($order->id);
         foreach ($order->items as $order_item) {
             $checkout->addItem(new Item($order_item->product_id, $order_item->product->name, $order_item->price));
         }
         $response = $checkoutService->checkout($checkout->getCheckout());
         $order->update(['payment_code' => $response->getCode()]);
         event(new CheckoutEvent($order, Auth::user()));
         $cart->clear();
         return redirect($response->getRedirectionUrl());
         //return view('checkout.place_order', ['order'=>$order, 'cart'=>'saved', 'categories'=>$categories]);
     }
     return view('checkout.place_order', ['cart' => 'empty', 'categories' => $categories]);
 }
開發者ID:mborgesmartins,項目名稱:lcodecommerce,代碼行數:26,代碼來源:CheckoutController.php

示例3: tag

 public function tag($id)
 {
     $categories = Category::all();
     $tag = Tag::find($id);
     $products = $tag->products;
     return view('store.tag', compact('categories', 'products', 'tag'));
 }
開發者ID:NiltonMorais,項目名稱:laravel_commerce,代碼行數:7,代碼來源:StoreController.php

示例4: place

 public function place(Order $orderModel, OrderItem $orderItem, CheckoutService $checkoutService)
 {
     if (!Session::has('cart')) {
         return false;
     }
     $cart = Session::get('cart');
     $categories = Category::all();
     if (count(Auth::user()->address) <= 0) {
         return redirect()->route('account_address')->with('address_exist', 'Você precisa ter um endereço de entrega antes de finalizar compra!');
     }
     if ($cart->getTotal() > 0) {
         $checkout = $checkoutService->createCheckoutBuilder();
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         foreach ($cart->all() as $k => $item) {
             $checkout->addItem(new Item($k, $item['name'], number_format($item['price'], 2, '.', ''), $item['qtd']));
             $order->items()->create(['product_id' => $k, 'price' => $item['price'], 'qtd' => $item['qtd']]);
         }
         // VER CONFIGURAÇÃO DE EMAIL
         // dd(Config::get('mail'));
         $cart->clear();
         event(new CheckoutEvent(Auth::user(), $order));
         $response = $checkoutService->checkout($checkout->getCheckout());
         // retorna para pagina interna do codecommerce
         //return view('store.checkout', compact('order', 'categories'));
         // retorna para pagina do pagseguro
         return redirect($response->getRedirectionUrl());
     }
     return view('store.checkout', ['cart' => 'empty', 'categories' => $categories]);
 }
開發者ID:sandro-rocha,項目名稱:laravel_commerce,代碼行數:29,代碼來源:CheckoutController.php

示例5: place

 public function place(Order $orderModel, OrderItem $ordemItem, CheckoutService $checkoutService)
 {
     if (!Session::has('cart')) {
         return "FALSE";
     }
     $cart = Session::get('cart');
     $categories = Category::all();
     if ($cart->getTotal() > 0) {
         $checkout = $checkoutService->createCheckoutBuilder();
         //pagseguro
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         //inclui na tabela
         foreach ($cart->all() as $k => $item) {
             $checkout->addItem(new Item($k, $item['name'], number_format($item['price'], 2, ".", ""), $item['qtd']));
             //pagseguro
             $order->items()->create(['product_id' => $k, 'price' => $item['price'], 'qtd' => $item['qtd']]);
             //inclui na tabela
         }
         $cart->clear();
         event(new CheckoutEvent(Auth::user(), $order));
         $response = $checkoutService->checkout($checkout->getCheckout());
         //pagseguro
         return redirect($response->getRedirectionUrl());
         //pagseguro
         #return view('store.checkout', compact('cart', 'order', 'categories'));
     } else {
         return view('store.checkout', ['cart' => 'empty', 'categories' => $categories]);
     }
 }
開發者ID:ecmattos,項目名稱:codecommerce,代碼行數:29,代碼來源:CheckoutController.php

示例6: show

 public function show($id = null)
 {
     $categories = !is_null($id) ? Category::where('id', $id)->get() : Category::all();
     foreach ($categories as $category) {
         echo $category->name . '<br>';
     }
 }
開發者ID:amrigo,項目名稱:l5-code-commerce,代碼行數:7,代碼來源:AdminCategoriesController.php

示例7: place

 public function place(Order $orderModel, OrderItem $orderItem)
 {
     //Método plcae order, quando acessar esse método ele ira acessar o carrinho de comprar e começar a executar
     //os pedidos
     if (!Session::has('cart')) {
         return false;
     }
     $cart = Session::get('cart');
     // recupera o carrinho de compras
     if ($cart->getTotal() > 0) {
         //Order retorna um id que será o código da ORDER
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         /*Método all corresponde ao método da classe Cart*/
         foreach ($cart->all() as $k => $item) {
             //Toda vez que der o save tem que passar a instancia lá para dentro
             $order->itens()->create(['product_id' => $k, 'price' => $item['price'], 'qtd' => $item['qtd']]);
         }
         // Para limpar o carrinho de compras
         $cart->clear();
         // Evento Checkout
         // Precisa passar o usuario, nome, order itens do pedido
         event(new CheckoutEvent(Auth::user(), $order));
         //event(new CheckoutEvent());
         return view('store.checkout', compact('order', 'cart'));
     }
     $categories = Category::all();
     return view('store.checkout', ['cart' => 'empty', 'categories' => $categories]);
 }
開發者ID:GabrielApG,項目名稱:CodeCommerce,代碼行數:28,代碼來源:CheckoutController.php

示例8: index

 public function index()
 {
     $categories = Category::all();
     $pFeatured = Product::featured()->get();
     $pRecommend = Product::recommend()->get();
     return view('store.index', compact('categories', 'pFeatured', 'pRecommend'));
 }
開發者ID:sandrosales,項目名稱:laravel_commerce-Pagseguro02,代碼行數:7,代碼來源:StoreController.php

示例9: category

 public function category($id)
 {
     $categories = Category::all();
     $category = Category::findOrNew($id);
     $products = Product::ofCategory($id)->get();
     return view('store.category', compact('categories', 'category', 'products'));
 }
開發者ID:nsouza,項目名稱:codeCommerce,代碼行數:7,代碼來源:StoreController.php

示例10: porudctTag

 public function porudctTag(Category $category, $id)
 {
     $categories = $category->all();
     $productsTag = $this->tag->find($id);
     $tags = $this->tag->all();
     //  dd($product->tags);
     return view('store.productsTag', compact('categories', 'tags', 'productsTag'));
 }
開發者ID:jaysongyn,項目名稱:CodeCommerce,代碼行數:8,代碼來源:StoreController.php

示例11: adressDestroy

 public function adressDestroy($id)
 {
     $enderecoRemove = Auth::user()->enderecos()->find($id);
     $enderecoRemove->delete();
     $endereco = Auth::user()->enderecos()->find($id);
     $categories = Category::all();
     $user = Auth::user();
     return redirect()->route('account.index', compact('categories', 'user', 'enderecos'));
 }
開發者ID:ahcornocyam,項目名稱:laravel-code-education-ecommerce,代碼行數:9,代碼來源:AccountController.php

示例12: productCategory

 public function productCategory($id)
 {
     $pCategory = Product::ProductCategory($id)->get();
     $category = $this->category->find($id);
     $categories = Category::all();
     if ($category) {
         return view('store.category', compact('categories', 'products', 'pCategory'));
     }
     return redirect()->route('store.index')->with('category_exist', 'Category not exist!');
 }
開發者ID:sandro-rocha,項目名稱:laravel_commerce,代碼行數:10,代碼來源:StoreController.php

示例13: index

 public function index()
 {
     $categories = Category::all();
     echo '<h1>Listagem de categorias</h1>';
     echo '<br/><ul>';
     foreach ($categories as $row) {
         echo '<li>' . $row->name . '</li>';
     }
     echo '</ul>';
 }
開發者ID:belloribes,項目名稱:code-commerce,代碼行數:10,代碼來源:AdminCategoriesController.php

示例14: tags

 public function tags($id)
 {
     $tag = Tag::find($id);
     if ($tag) {
         $categories = Category::all();
         $products = $tag->products;
         $tag_name = $tag->name;
         return view('store.tags', compact('categories', 'tag_name', 'products'));
     } else {
         return redirect()->route('store.index');
     }
 }
開發者ID:arliton,項目名稱:CodeCommerce,代碼行數:12,代碼來源:StoreController.php

示例15: place

 public function place(\CodeCommerce\Order $orderModel, \CodeCommerce\OrderItem $ordemItem, \CodeCommerce\Category $category)
 {
     if (!Session::has('cart')) {
         return false;
     }
     $cart = Session::get('cart');
     if ($cart->getTotal() > 0) {
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         foreach ($cart->all() as $k => $item) {
             $items = $ordemItem->create(['order_id' => $order->id, 'product_id' => $k, 'price' => $item['price'], 'qtd' => $item['qtd']]);
         }
         $cart->clear();
         event(new \CodeCommerce\Events\CheckoutEvent(Auth::user(), $order));
         return view('store.checkout', compact('order'));
     }
     $categories = $category->all();
     return view('store.checkout', ['cartEmpty' => true, 'categories' => $categories]);
 }
開發者ID:eduardolcouto,項目名稱:laravel-commerce,代碼行數:18,代碼來源:CheckoutController.php


注:本文中的CodeCommerce\Category::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。