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


PHP Brand::where方法代码示例

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


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

示例1: showProduct

 public function showProduct($brandname, $catname)
 {
     $brandname = urlunslug($brandname);
     $catname = urlunslug($catname);
     $brand = Brand::where('name', '=', $brandname)->first();
     $productcat = Productcategory::where('brand_id', '=', $brand->id)->where('name', '=', $catname)->select('id', 'type')->first();
     $productsObj = Productcategory::find($productcat->id)->products();
     $mode = Input::get('mode', 'retail');
     $products = $productsObj->select('id', 'productcat_id', 'brand_id', 'barcodeid', 'name', 'quantity', 'almost_finished', 'costprice', 'published', $mode . '_price as price', $mode . '_discount as discount', $mode . '_discountedprice as discountedprice', $mode . '_totalprice as totalprice');
     if ($products == null) {
         return $this->callErrorPage(404);
     }
     $products = $products->orderBy('id', 'desc')->get();
     $data['products'] = $products->toArray();
     $data['sum_total'] = $this->_sumTotalprice($data['products']);
     $data['sum_cost'] = $this->_sumTotalcost($data['products']);
     $data['profit_margin'] = $data['sum_total'] - $data['sum_cost'];
     $data['addProductLink'] = array('brand_id' => $brand->id, 'productcat_id' => $productcat->id);
     $data['mode'] = $mode;
     $data['brand'] = $brand;
     $data['cat'] = $catname;
     Larasset::start('footer')->js('dataTables-min', 'dataTables-bootstrap', 'bootstrap_editable');
     Larasset::start('header')->css('bootstrap_editable');
     if (!Request::ajax()) {
         $data['modes'] = Mode::listModes();
         $this->layout->title = $brand['name'] . ' - ' . $catname;
         $blade = $productcat->type === 'service' ? 'showservice' : 'tab_showproduct';
         $this->layout->content = View::make('admin.liststock.' . $blade, $data);
     } else {
         return View::make('admin.liststock.showproduct', $data);
     }
 }
开发者ID:sliekasirdis79,项目名称:POS,代码行数:32,代码来源:StockProductController.php

示例2: showCategory

 public function showCategory($brandname)
 {
     $brandname = urlunslug($brandname);
     $brand = Brand::where('name', '=', $brandname)->first();
     //This will trigger 404 Error page if The brand requested does not exit
     if ($brand == null) {
         return $this->callErrorPage(404);
     }
     $ids = Productcategory::where('brand_id', '=', $brand->id)->lists('id');
     $this->_monitorChildrenStatus($ids);
     $category = Brand::find($brand->id)->categories->toArray();
     $data['category'] = $category;
     $data['brand'] = $brand;
     $this->layout->title = $brand->name . " - Categories";
     $this->layout->content = View::make('admin.liststock.showcategory', $data);
     Larasset::start('header')->css('bootstrap_editable');
     Larasset::start('footer')->js('bootstrap_editable');
 }
开发者ID:sliekasirdis79,项目名称:POS,代码行数:18,代码来源:StockProductCategoryController.php

示例3: delete_brand

 public function delete_brand()
 {
     $id = Request::segment(4);
     $brand = Brand::find($id);
     Brand::where('id', $id)->delete();
     $message = "Successfully deleted the brand";
     $type = "success";
     return Redirect::to('/admin/brands')->with('type', $type)->with('message', $message);
 }
开发者ID:sohelrana820,项目名称:mario-gomez,代码行数:9,代码来源:AdminController.php

示例4: validarNoRepit

 public function validarNoRepit($text)
 {
     $brands = Brand::where('nombre', '=', $text)->orWhere('shortname', '=', $text)->first();
     return $brands;
 }
开发者ID:softwareDiaz,项目名称:prueba,代码行数:5,代码来源:PriceDolarRepo.php

示例5: post_product_add

 public function post_product_add()
 {
     $data = Input::all();
     $sessionArr = array("name" => "", "price" => "", "attrs" => array());
     $attributes = array();
     //check that product model is exist!
     $productCheck = Product::where('model', '=', $data['p_model'])->first();
     if (empty($productCheck)) {
         //first we fetch the brand and get the ID
         if (empty($data['p_brand_other'])) {
             $brand = $data['p_brand'];
             //e.g $brand = 3;
         } else {
             //here we get brand ID by brand_other's input if the brand_other is filled
             $brandCheck = Brand::where("name", '=', $data['p_brand_other'])->first();
             if (empty($brandCheck)) {
                 $brand = DB::table('brands')->insert_get_id(array('name' => $data['p_brand_other'], 'alias' => Str::slug($data['p_brand_other'])));
             } else {
                 $brand = $brandCheck->id;
             }
         }
         $brandName = Brand::where("id", '=', $brand)->only('name');
         $brandalias = Brand::where("id", '=', $brand)->only('alias');
         $imageIDs = array();
         //pic
         $images = $data["userfile"];
         $mainImg = $data["active"];
         $CategoryfurImages = Category::with('getDescriptions')->where("id", "=", $data['p_category'])->first();
         for ($i = 0; $i < sizeof($images['name']); $i++) {
             $img = array('name' => $images['name'][$i], 'type' => $images["type"][$i], "tmp_name" => $images["tmp_name"][$i], "error" => $images["error"][$i], "size" => $images["size"][$i]);
             try {
                 array_push($imageIDs, $this->imageSizer($img, $CategoryfurImages));
             } catch (Exception $e) {
                 Session::flash('status', 'Resim eklemede hata oluştu Ürünü tekrar ekleyiniz!\\r\\n' . $e->getMessage());
                 return Redirect::to('admin/product/new');
             }
         }
         //now insert the product, first things first.
         $product = DB::table('products')->insert_get_id(array('brand_id' => $brand, 'model' => $data['p_model'], 'price' => ceil($data['p_price'] / 1.18), 'quantity' => $data['p_qty'], 'tax_class_id' => $data['p_tax'], 'barcode' => $data['p_barcode'], 'alias' => trim(Str::slug($brandalias . ' ' . $data['p_model'])), 'created_at' => DB::raw('NOW()'), 'updated_at' => DB::raw('NOW()')));
         //inserting pictures
         for ($i = 0; $i < count($imageIDs); $i++) {
             $imagesSql = DB::table('product_images')->insert(array('product_id' => $product, 'main' => $mainImg[$i] == 1 ? 1 : 0, 'unique_id' => $imageIDs[$i]));
         }
         $productDescription = DB::table('product_descriptions')->insert_get_id(array('product_id' => $product, 'name' => $brandName . ' ' . $data['p_model'], 'description' => $data['p_description'], 'variant' => $data['p_variant'], 'tag' => $data['p_tag']));
         $sessionArr["name"] = $brandName . ' ' . $data['p_model'];
         $sessionArr["price"] = ceil($data['p_price'] / 1.18);
         //we insert the product now we set the category where the product belong
         $cagetory = DB::table('map_product_category')->insert_get_id(array('product_id' => $product, 'category_id' => $data['p_category']));
         $attr_other = $data['attr_other'];
         $attrs = array();
         $check = true;
         foreach ($data['attr'] as $k => $v) {
             if (!empty($data['attr_other'][$k])) {
                 $CheckTheAttr = Attribute::where_attribute_group_id_and_value($k, $attr_other[$k])->first();
                 if ($CheckTheAttr == null) {
                     $attrotherID = DB::table('attributes')->insert_get_id(array('attribute_group_id' => $k, 'value' => $data['attr_other'][$k]));
                     array_push($attributes, "Ekstra eklenen ve girilen ürün özelliği : " . $attr_other[$k]);
                     $attrs[$k] = $attrotherID;
                 } else {
                     $attrs[$k] = $v;
                 }
             } else {
                 array_push($attributes, "Girilen ürün özelliği : " . $v);
                 $attrs[$k] = $v;
             }
         }
         array_push($sessionArr["attrs"], $attributes);
         $attrsOrdered = array();
         foreach ($attrs as $k => $v) {
             $attrsOrdered[] = array('product_id' => $product, 'attribute_id' => $v);
         }
         $attrs = DB::table('map_product_attribute')->insert($attrsOrdered);
     } else {
         Session::flash('status', 'Bu ürün daha önce sisteme eklenmiş!');
         return Redirect::to('admin/product/new');
     }
     return Redirect::to('admin/product/new')->with("result", $sessionArr);
 }
开发者ID:TahsinGokalp,项目名称:L3-Eticaret,代码行数:78,代码来源:admin.php

示例6: deleteBrands

 public function deleteBrands()
 {
     $ids = explode(',', Input::get('javascriptArrayString'));
     //$ids = (!is_array($ids)) ? array($ids) : $ids;
     foreach ($ids as $id) {
         //Lets fetch the Brand Image name
         $logo = Brand::where('id', $id)->pluck('brandlogo');
         //Lets check if the file exists
         $file = Config::get('software.dir_upload_logo');
         if ($logo !== '' and file_exists($file . $logo)) {
             unlink($file . $logo);
         }
         //tt($logo);
     }
     Brand::destroy($ids);
     $data['status'] = 'success';
     $data['message'] = 'Deleted successfully';
     return Response::json($data);
 }
开发者ID:sliekasirdis79,项目名称:POS,代码行数:19,代码来源:StockBrandController.php


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