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


PHP Category::actives方法代碼示例

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


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

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param int $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $product = Product::find($id);
     if (\Auth::id() != $product->user_id) {
         return redirect('products/' . $product->user_id)->withErrors(['not_access' => [trans('globals.not_access')]]);
     }
     $typeItem = $product->type;
     $disabled = '';
     $order = OrderDetail::where('product_id', $id)->join('orders', 'order_details.order_id', '=', 'orders.id')->first();
     if ($order) {
         $disabled = 'disabled';
     }
     $features = ProductDetail::all()->toArray();
     $allCategoriesStore = Category::actives()->lightSelection()->get()->toArray();
     $categories = ['' => trans('product.controller.select_category')];
     //categories drop down formatted
     productsHelper::categoriesDropDownFormat($allCategoriesStore, $categories);
     $condition = ['new' => trans('product.controller.new'), 'refurbished' => trans('product.controller.refurbished'), 'used' => trans('product.controller.used')];
     $edit = true;
     $panel = $this->panel;
     $oldFeatures = ProductDetail::oldFeatures($product->features);
     $productsDetails = new featuresHelper();
     return view('products.form', compact('product', 'panel', 'features', 'categories', 'condition', 'typeItem', 'disabled', 'edit', 'oldFeatures', 'productsDetails'));
 }
開發者ID:softsolution,項目名稱:antVel,代碼行數:31,代碼來源:ProductsController.php

示例2: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $product = Product::find(-50);
     $features = ProductDetail::all()->toArray();
     $arrayCategories = Category::actives()->lightSelection()->get()->toArray();
     $categories = ["" => trans("product.controller.select_category")];
     $condition = ['new' => trans('product.controller.new'), 'refurbished' => trans('product.controller.refurbished'), 'used' => trans('product.controller.used')];
     $typesProduct = ['item' => trans("product.controller.item"), 'key' => trans("product.globals.digital_item") . ' ' . trans("product.globals.key")];
     $typeItem = 'item';
     foreach ($arrayCategories as $row) {
         #just a little bit of pre format in categories dropdown
         $level = categoriesHelper::level($arrayCategories, $row['category_id']);
         $s = '';
         for ($i = 0; $i < $level; $i++) {
             $s .= '&nbsp;&nbsp;&nbsp;';
         }
         $icon = 2;
         if ($level % 3 == 0) {
             $icon = 0;
         } elseif ($level % 2 == 0) {
             $icon = 1;
         }
         $indentation = ['&#9679;', '&#8226;', '&ordm;'][$icon];
         #end pre format
         $categories[$row['id']] = $s . $indentation . '&nbsp;' . $row['name'];
     }
     $disabled = '';
     $edit = false;
     $panel = $this->panel;
     $oldFeatures = ProductDetail::oldFeatures([]);
     $productsDetails = new featuresHelper();
     return view('products.form', compact('product', 'panel', 'features', 'categories', 'condition', 'typeItem', 'typesProduct', 'disabled', 'edit', 'oldFeatures', 'productsDetails'));
 }
開發者ID:rolka,項目名稱:antVel,代碼行數:38,代碼來源:ProductsController.php


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