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


PHP Brand::find方法代码示例

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


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

示例1: addProducts

 public function addProducts($brandid, $catid)
 {
     Larasset::start('header')->css('magicsuggest');
     Larasset::start('footer')->js('magicsuggest');
     $productcat = Productcategory::find($catid)->toArray();
     $brand = Brand::find($productcat['brand_id'])->toArray();
     $data['productcat'] = $productcat;
     $data['brand'] = $brand;
     return View::make('admin.create.addproduct', $data);
 }
开发者ID:sliekasirdis79,项目名称:POS,代码行数:10,代码来源:StockProductController.php

示例2: getBrands

 function getBrands()
 {
     $store_brands = array();
     $db_brands = $GLOBALS['DB']->query("SELECT brands.* FROM\n                stores JOIN brands_stores ON (stores.id = brands_stores.store_id)\n                       JOIN brands ON (brands_stores.brand_id = brands.id)\n                WHERE stores.id = {$this->getId()};");
     foreach ($db_brands as $brand) {
         $found_brand = Brand::find($brand['id']);
         array_push($store_brands, $found_brand);
     }
     return $store_brands;
 }
开发者ID:ben-pritchard,项目名称:Epicodus-Assessment---PHP-Many-to-Many-in-Silex,代码行数:10,代码来源:Store.php

示例3: postUpdate

 public function postUpdate()
 {
     $brand_id = Input::get('brand_id');
     $categories = array_values(Input::get('categories'));
     $brand = Brand::find($brand_id);
     $brand->name = Input::get('brand');
     $brand->save();
     $brand->categories()->sync($categories);
     return Redirect::back()->withErrors(['succes' => 'actualizacion :D']);
 }
开发者ID:PaoloPaz,项目名称:crud_ajax_laravel_4.2,代码行数:10,代码来源:BrandController.php

示例4: testFind

 function testFind()
 {
     $brand_name = "Air Jordan";
     $test_brand = new Brand($brand_name);
     $test_brand->save();
     $brand_name2 = "Nike";
     $test_brand2 = new Brand($brand_name2);
     $test_brand2->save();
     $result = Brand::find($test_brand->getId());
     $this->assertEquals($test_brand, $result);
 }
开发者ID:CaseyH33,项目名称:Shoes,代码行数:11,代码来源:BrandTest.php

示例5: testFind

 function testFind()
 {
     $name = "Clides";
     $test_brand = new Brand($name);
     $test_brand->save();
     $name2 = "Marthas";
     $test_brand2 = new Brand($name2);
     $test_brand2->save();
     $result = Brand::find($test_brand->getId());
     $this->assertEquals($test_brand, $result);
 }
开发者ID:alexMcosta,项目名称:Shoes_Brands,代码行数:11,代码来源:BrandTest.php

示例6: totalProductWorth

 public static function totalProductWorth($brand_id)
 {
     $prices = Brand::find($brand_id)->products->lists('total_price');
     if ($prices != null and !empty($prices)) {
         foreach ($prices as $price) {
             @($p += $price);
         }
         return $p;
     }
     return 0;
 }
开发者ID:sliekasirdis79,项目名称:POS,代码行数:11,代码来源:Brand.php

示例7: UpdateListBrand

 public function UpdateListBrand()
 {
     $input = Input::all();
     $listBrandID = $input['update_list_brand_id'];
     $listBrandID = explode(",", $listBrandID);
     foreach ($listBrandID as $p) {
         if ($input['name'] != '') {
             $brand = Brand::find($p);
             $brand->name = $input['name'];
             $brand->save();
         }
     }
 }
开发者ID:hungleon2112,项目名称:giaymaster,代码行数:13,代码来源:BrandController.php

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     //
     $validation = Validate::BrandValidation(Input::all());
     if ($validation->fails()) {
         return Redirect::to('marca/create')->withErrors($validation)->withInput();
     } else {
         $brand = Brand::find($id);
         $brand->brand = Input::get('brand');
         $brand->save();
         return Redirect::to('admin/marca');
     }
 }
开发者ID:abrahammontas,项目名称:Supplements-online-store,代码行数:19,代码来源:BrandController.php

示例9: test_find

 function test_find()
 {
     //Arrange
     $brand_name = "Nike";
     $test_brand = new Brand($id, $brand_name);
     $test_brand->save();
     $brand_name2 = "Adidas";
     $test_brand2 = new Brand($id, $brand_name2);
     $test_brand2->save();
     //Act
     $result = Brand::find($test_brand->getId());
     //Assert
     $this->assertEquals($test_brand, $result);
 }
开发者ID:sammartinez,项目名称:Silex-Bootstrap,代码行数:14,代码来源:BrandTest.php

示例10: putEdit

 public function putEdit($id)
 {
     $brand = Brands::find((int) $id);
     if (empty($brand)) {
         return Redirect::to('admin/brand')->with('errors', 'Invalid Brand ID');
     }
     $fields = array('title' => Input::get('title'), 'description' => Input::get('description'), 'status' => Input::get('status'), 'visibility' => Input::get('visibility'), 'slug' => Input::get('slug'), 'url' => Input::get('url'));
     $rules = array('title' => "required|unique:brands,title,{$id}", 'slug' => "required|unique:brands,slug,{$id}");
     $v = Validator::make($fields, $rules);
     if ($v->fails()) {
         return Redirect::to("admin/brand/edit/{$id}")->withErrors($v)->withInput();
     }
     $brand->fill($fields);
     $brand->save();
     return Redirect::to('admin/brand')->with('message', 'Brand Updated');
 }
开发者ID:sgh1986915,项目名称:laravel-bizgym,代码行数:16,代码来源:AdminController.php

示例11: saveAddCategory

 public function saveAddCategory()
 {
     $catsArray = json_decode(Input::get('category'));
     $brand_id = Input::get('brand_id');
     $cat_type = Input::get('cat_type');
     if (!empty($catsArray)) {
         //We fetch the name of categories under that brand
         $brandModel = Brand::find($brand_id);
         $brandCat = $brandModel->categories->lists('name');
         $brandName = $brandModel->name;
         $tempStoreCatsForLog['cats'] = array();
         foreach ($catsArray as $category) {
             //We check if the new category existed in the list of categories under the brand
             if (in_array($category, $brandCat)) {
                 $data['status'] = 'error';
                 $data['message'] = $category . ' already exist';
             } else {
                 $cat = new Productcategory();
                 $cat->name = strtolower(trim(extract_char($category, array('text', 'int'))));
                 $cat->brand_id = $brand_id;
                 $cat->type = $cat_type;
                 $tempStoreCatsForLog['cats'][] = $cat->name;
                 if (!$cat->save()) {
                     $data = $cat->validatorStatus;
                 } elseif (empty($data)) {
                     $data['status'] = 'success';
                     $data['message'] = 'Created successfully';
                 }
             }
         }
         if (!empty($tempStoreCatsForLog['cats'])) {
             //Log area
             $log['products'] = "[ {$brandName} ] = " . implode(' | ', $tempStoreCatsForLog['cats']);
             $log['stocktype'] = 'create';
             $this->_saveActivityLog($log);
         }
     } else {
         $data['status'] = 'error';
         $data['message'] = 'Field can not be empty';
     }
     return Response::json($data);
 }
开发者ID:sliekasirdis79,项目名称:POS,代码行数:42,代码来源:StockProductCategoryController.php

示例12: test_find

 function test_find()
 {
     //Arrange
     $brand_name = "Nike";
     $id = 1;
     $test_brand = new Brand($brand_name, $id);
     $test_brand->save();
     //Act
     $result = Brand::find($test_brand->getId());
     //Assert
     $this->assertEquals($test_brand, $result);
 }
开发者ID:kevintokheim,项目名称:Shoe_Store,代码行数:12,代码来源:BrandTest.php

示例13: testFind

 function testFind()
 {
     //Arrange
     $brand_name = "Super Kicks";
     $test_brand = new Brand($brand_name);
     $test_brand->save();
     $brand_name2 = "Cool Shoes";
     $test_brand2 = new Brand($brand_name2);
     $test_brand->save();
     //Act
     $id = $test_brand->getId();
     $result = Brand::find($id);
     //Assert
     $this->assertEquals($test_brand, $result);
 }
开发者ID:kylepratuch,项目名称:Shoe_Store,代码行数:15,代码来源:BrandTest.php

示例14: single_product

 public function single_product()
 {
     $product_id = Request::segment(2);
     $product = Product::find($product_id);
     if (!$product) {
         $response_array = array('success' => 'false', 'error_code' => '406', 'error' => 'Product not found.');
         $response_code = 200;
         $response = Response::json($response_array, $response_code);
         return $response;
     } else {
         $response_array['success'] = 'true';
         $response_array['product'] = $product->toArray();
         $response_array['product']['brand'] = array();
         $response_array['product']['tags'] = array();
         $response_array['product']['alternatives'] = array();
         $brand = Brand::find($product->brand_id)->toArray();
         if ($brand) {
             $response_array['product']['brand'] = $brand;
         }
         $tags = DB::table('product_tag')->where('product_tag.product_id', $product->id)->leftJoin('options', 'product_tag.option_id', '=', 'options.id')->select('options.id', 'options.name')->get();
         if ($tags) {
             foreach ($tags as $tag) {
                 $tag = json_decode(json_encode($tag), true);
                 array_push($response_array['product']['tags'], $tag);
             }
         }
         $products = DB::table('product_alternative')->where('product_alternative.product_id', $product->id)->leftJoin('products', 'product_alternative.alternative_product_id', '=', 'products.id')->select('products.*')->get();
         if ($products) {
             foreach ($products as $product) {
                 $product = json_decode(json_encode($product), true);
                 array_push($response_array['product']['alternatives'], $product);
             }
         }
         $response_code = 200;
         $response = Response::json($response_array, $response_code);
         return $response;
     }
 }
开发者ID:sohelrana820,项目名称:mario-gomez,代码行数:38,代码来源:StoreController.php

示例15: testFind

 function testFind()
 {
     //Arrange
     $brand_name = "Nike";
     $test_brand = new Brand($brand_name, $id);
     $test_brand->save();
     $brand_name2 = "Reebok";
     $test_brand2 = new Brand($brand_name2, $id2);
     $test_brand2->save();
     //Act
     $result = Brand::find($test_brand2->getId());
     //assert
     $this->assertEquals($test_brand2, $result);
 }
开发者ID:jtorrespdx,项目名称:Shoe_stores,代码行数:14,代码来源:BrandTest.php


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