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


PHP Product::whereCode方法代碼示例

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


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

示例1: setData

 public static function setData(CellCollection $v)
 {
     $product = Product::whereCode($v->product_code)->first();
     return ['group' => $v->group, 'number' => $v->number, 'product_id' => $product->id, 'product_code' => $product->code, 'mix_no' => $product->mix_no, 'product_description' => $product->description, 'qty' => $v->qty, 'unit' => $v->unit, 'remark' => $v->remark];
 }
開發者ID:vasitjuntong,項目名稱:mixed,代碼行數:5,代碼來源:UploadRequesitionItem.php

示例2: setData

 public static function setData(CellCollection $v)
 {
     $product = Product::whereCode($v->product_code)->first();
     $location = Location::whereName($v->location)->first();
     return ['product_id' => $product->id, 'product_code' => $product->code, 'mix_no' => $product->mix_no, 'product_description' => $product->description, 'location_id' => $location->id, 'location_name' => $location->name, 'qty' => $v->qty, 'remark' => $v->remark];
 }
開發者ID:vasitjuntong,項目名稱:mixed,代碼行數:6,代碼來源:UploadReceiveItem.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // parse url
     $url = $this->parseURLPDF();
     // Parse pdf file and build necessary objects.
     $parser = new \Smalot\PdfParser\Parser();
     $pdf = $parser->parseFile($url);
     $pages = $pdf->getPages();
     foreach ($pages as $page) {
         $p = new ParsePage($page->getArray());
         $products = $p->parseProducts();
         foreach ($products as $product) {
             $p = Product::whereCode($product['code'])->first();
             if (is_null($p)) {
                 $p = new Product();
             }
             $p->fill($product);
             $p->save();
         }
     }
 }
開發者ID:Aphix-Labs,項目名稱:bodega-laravel,代碼行數:26,代碼來源:ParsePDF.php


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