• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP models\Item类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中app\models\Item的典型用法代码示例。如果您正苦于以下问题:PHP Item类的具体用法?PHP Item怎么用?PHP Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     $folderpath = base_path() . '/database/seeds/templates/';
     $folders = File::directories($folderpath);
     $latest = '11232015';
     foreach ($folders as $value) {
         $_dir = explode("/", str_replace('\\', '/', $value));
         $cnt = count($_dir);
         $name = $_dir[$cnt - 1];
         $latest_date = DateTime::createFromFormat('mdY', $latest);
         $now = DateTime::createFromFormat('mdY', $name);
         if ($now > $latest_date) {
             $latest = $name;
         }
     }
     $filePath = $folderpath . $latest . '/Masterfile.xlsx';
     $reader = ReaderFactory::create(Type::XLSX);
     // for XLSX files
     $reader->open($filePath);
     DB::table('channel_items')->truncate();
     foreach ($reader->getSheetIterator() as $sheet) {
         if ($sheet->getName() == 'MKL Mapping') {
             $cnt = 0;
             foreach ($sheet->getRowIterator() as $row) {
                 if ($row[0] != '') {
                     if ($cnt > 0) {
                         // dd($row);
                         if (!ctype_digit(trim($row[4])) || !ctype_digit(trim($row[5])) || !ctype_digit(trim($row[6]))) {
                             InvalidMapping::create(['premise_code' => trim($row[0]), 'customer_code' => trim($row[1]), 'store_code' => trim($row[2]), 'sku_code' => trim($row[3]), 'ig' => trim($row[4]), 'multiplier' => trim($row[5]), 'minstock' => trim($row[6]), 'type' => 'MKL Mapping', 'remarks' => 'Invalid mapping']);
                         } else {
                             $channel = '';
                             if (trim($row[0]) != '') {
                                 $channel = Channel::where('channel_code', trim($row[0]))->first();
                             }
                             $item = Item::where('sku_code', trim($row[3]))->first();
                             if (!empty($item)) {
                                 $item_type = ItemType::where('type', "MKL")->first();
                                 $osa_tagging = 0;
                                 if (isset($row[7])) {
                                     $osa_tagging = trim($row[7]);
                                 }
                                 $npi_tagging = 0;
                                 if (isset($row[8])) {
                                     $npi_tagging = trim($row[8]);
                                 }
                                 ChannelItem::firstOrCreate(['channel_id' => $channel->id, 'item_id' => $item->id, 'item_type_id' => $item_type->id, 'ig' => trim($row[4]), 'fso_multiplier' => trim($row[5]), 'min_stock' => trim($row[6]), 'osa_tagged' => $osa_tagging, 'npi_tagged' => $npi_tagging]);
                             }
                         }
                     }
                     $cnt++;
                 }
             }
         }
     }
     $reader->close();
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:64,代码来源:UploadChannelItemsTableSeeder.php


示例2: run

 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     $folderpath = base_path() . '/database/seeds/seed_files/';
     $folders = File::directories($folderpath);
     $latest = '11232015';
     foreach ($folders as $value) {
         $_dir = explode("/", str_replace('\\', '/', $value));
         $cnt = count($_dir);
         $name = $_dir[$cnt - 1];
         $latest_date = DateTime::createFromFormat('mdY', $latest);
         $now = DateTime::createFromFormat('mdY', $name);
         if ($now > $latest_date) {
             $latest = $name;
         }
     }
     $filePath = $folderpath . $latest . '/Masterfile.xlsx';
     $reader = ReaderFactory::create(Type::XLSX);
     // for XLSX files
     $reader->open($filePath);
     echo 'Seeding ' . $filePath . PHP_EOL;
     // DB::table('other_barcodes')->truncate();
     Item::where('active', 1)->update(['cleared' => 0]);
     foreach ($reader->getSheetIterator() as $sheet) {
         if ($sheet->getName() == 'Other Codes') {
             $cnt = 0;
             foreach ($sheet->getRowIterator() as $row) {
                 if (!is_null($row[0]) && trim($row[0]) != '') {
                     if ($cnt > 0) {
                         $item = Item::where('sku_code', trim($row[0]))->first();
                         if (!empty($item)) {
                             if ($item->cleared == 0) {
                                 OtherBarcode::where('item_id', $item->id)->delete();
                                 $item->cleared = 1;
                                 $item->save();
                             }
                             $area = Area::where('area', strtoupper($row[1]))->first();
                             if (!empty($item) && !empty($area)) {
                                 OtherBarcode::firstOrCreate(['item_id' => $item->id, 'area_id' => $area->id, 'other_barcode' => trim($row[2])]);
                             }
                         } else {
                             // dd($row);
                         }
                     }
                     $cnt++;
                 }
             }
         }
     }
     $reader->close();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     Model::reguard();
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:54,代码来源:UploadOtherBarcodesTableSeeder.php


示例3: transform

 /**
  * @param Item $item
  * @return array
  */
 public function transform(Item $item)
 {
     $array = ['id' => $item->id, 'parent_id' => $item->parent_id, 'title' => $item->title, 'body' => $item->body, 'index' => $item->index, 'category_id' => $item->category_id, 'priority' => $item->priority, 'urgency' => $item->urgency, 'favourite' => $item->favourite, 'pinned' => $item->pinned, 'path' => $item->path, 'has_children' => $item->has_children, 'category' => $item->category->transform(), 'alarm' => $item->alarm, 'timeLeft' => null, 'notBefore' => $item->not_before, 'recurringUnit' => $item->recurring_unit, 'recurringFrequency' => $item->recurring_frequency, 'children' => false];
     if ($item->trashed()) {
         $array['deleted_at'] = $item->deleted_at->format('Y-m-d H:i:s');
     }
     return $array;
 }
开发者ID:JennySwift,项目名称:lists,代码行数:12,代码来源:ItemTransformer.php


示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // ---------------------------------------------------------------------
     // CONFERENCE 4
     // ---------------------------------------------------------------------
     $conference = Conference::find(4);
     $item = ['name' => 'Laptop', 'quantity' => 1];
     $item = new Item($item);
     $item->conference()->associate($conference);
     $item->save();
     $item = ['name' => 'Projector', 'quantity' => 1];
     $item = new Item($item);
     $item->conference()->associate($conference);
     $item->save();
 }
开发者ID:vinlore,项目名称:huddle,代码行数:20,代码来源:ItemsSeeder.php


示例5: delete

 public function delete(Request $request, $id)
 {
     $b = Item::find($id);
     $b->name = $request->input('name');
     $b->delete();
     return Redirect('itemmaster');
 }
开发者ID:richardkeep,项目名称:prct,代码行数:7,代码来源:ItemmasterController.php


示例6: actionIndex

 /**
  * @return string
  */
 public function actionIndex()
 {
     $low_stock_items = Item::find()->where('quantity >= 1 AND quantity <= 10')->all();
     $empty_stock_items = Item::find()->where('quantity = 0')->all();
     $logs = Log::find()->orderBy('created_at DESC')->limit(10)->all();
     return $this->render('index', ['low_stock_items' => $low_stock_items, 'empty_stock_items' => $empty_stock_items, 'logs' => $logs]);
 }
开发者ID:edarkzero,项目名称:mi_taller,代码行数:10,代码来源:SiteController.php


示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     foreach (StoreInventories::where('fixed', 0)->get() as $inventory) {
         $inventory_items = ItemInventories::where('store_inventory_id', $inventory->id)->get();
         foreach ($inventory_items as $item) {
             $t_item = TempInventories::where('store_inventory_id', $inventory->id)->where('other_barcode', $item->other_barcode)->first();
             if (empty($t_item)) {
                 TempInventories::insert(array('id' => $item->id, 'store_inventory_id' => $item->store_inventory_id, 'division' => $item->division, 'category' => $item->category, 'category_long' => $item->category_long, 'sub_category' => $item->sub_category, 'brand' => $item->brand, 'sku_code' => $item->sku_code, 'other_barcode' => $item->other_barcode, 'description' => $item->description, 'description_long' => $item->description_long, 'lpbt' => $item->lpbt, 'conversion' => $item->conversion, 'ig' => $item->ig, 'fso_multiplier' => $item->fso_multiplier, 'sapc' => $item->sapc, 'whpc' => $item->whpc, 'whcs' => $item->whcs, 'so' => $item->so, 'fso' => $item->fso, 'fso_val' => $item->fso_val));
             }
         }
         $inventory->fixed = 1;
         $inventory->update();
         ItemInventories::where('store_inventory_id', $inventory->id)->delete();
         $store = Store::where('storeid', $inventory->store_id)->first();
         $skus = DB::table('store_items')->select('store_items.id', 'store_items.store_id', 'items.description', 'items.conversion', 'store_items.ig', 'store_items.fso_multiplier', 'items.lpbt', 'categories.category_long', 'sub_categories.sub_category', 'brands.brand', 'divisions.division', 'other_barcodes.other_barcode', 'items.sku_code')->join('stores', 'stores.id', '=', 'store_items.store_id')->join('items', 'items.id', '=', 'store_items.item_id')->join('other_barcodes', 'other_barcodes.item_id', '=', 'items.id')->join('categories', 'categories.id', '=', 'items.category_id')->join('sub_categories', 'sub_categories.id', '=', 'items.sub_category_id')->join('brands', 'brands.id', '=', 'items.brand_id')->join('divisions', 'divisions.id', '=', 'items.division_id')->whereRaw('other_barcodes.area_id = stores.area_id')->where('store_items.store_id', $store->id)->orderBy('items.id', 'asc')->get();
         foreach ($skus as $sku) {
             $temp_item = TempInventories::where('store_inventory_id', $inventory->id)->where('other_barcode', $sku->other_barcode)->first();
             if (empty($temp_item)) {
                 $item2 = Item::with('division')->with('category')->with('subcategory')->with('brand')->where('sku_code', $sku->sku_code)->first();
                 $fso = $sku->ig;
                 if ($sku->fso_multiplier > $sku->ig) {
                     $fso = $sku->fso_multiplier;
                 }
                 ItemInventories::insert(['store_inventory_id' => $inventory->id, 'division' => $item2->division->division, 'category' => $item2->category->category, 'category_long' => $item2->category->category_long, 'sub_category' => $item2->subcategory->sub_category, 'brand' => $item2->brand->brand, 'sku_code' => $item2->sku_code, 'other_barcode' => $sku->other_barcode, 'description' => $item2->description, 'description_long' => $item2->description_long, 'lpbt' => $item2->lpbt, 'conversion' => $sku->conversion, 'ig' => $sku->ig, 'fso_multiplier' => $sku->fso_multiplier, 'sapc' => 0, 'whpc' => 0, 'whcs' => 0, 'so' => $sku->ig, 'fso' => $fso, 'fso_val' => $item2->lpbt * $sku->ig]);
             } else {
                 ItemInventories::insert(['store_inventory_id' => $temp_item->store_inventory_id, 'division' => $temp_item->division, 'category' => $temp_item->category, 'category_long' => $temp_item->category_long, 'sub_category' => $temp_item->sub_category, 'brand' => $temp_item->brand, 'sku_code' => $temp_item->sku_code, 'other_barcode' => $temp_item->other_barcode, 'description' => $temp_item->description, 'description_long' => $temp_item->description_long, 'lpbt' => $temp_item->lpbt, 'conversion' => $temp_item->conversion, 'ig' => $temp_item->ig, 'fso_multiplier' => $temp_item->fso_multiplier, 'sapc' => $temp_item->sapc, 'whpc' => $temp_item->whpc, 'whcs' => $temp_item->whcs, 'so' => $temp_item->so, 'fso' => $temp_item->fso, 'fso_val' => $temp_item->fso_val]);
             }
         }
     }
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:35,代码来源:FixItemInventories.php


示例8: items

 public function items()
 {
     $fileName = "Items Mastefile.csv";
     $writer = WriterFactory::create(Type::CSV);
     // for CSV files
     $writer->openToBrowser($fileName);
     // stream data directly to the browser
     $writer->addRow(array('Category Long Description', 'Category Short Description', 'SKU Code', 'Barcode', 'Item Short Description', 'Item Long Description', 'Conversion', 'Sub Category', 'Brand', 'Division', 'LPBT/Cond Value (PC)', 'Status'));
     $items = Item::select(\DB::raw('category_long, category, sku_code, barcode, description, 
         description_long, conversion, sub_category, brand, division, lpbt, items.active'))->join('categories', 'categories.id', '=', 'items.category_id')->join('sub_categories', 'sub_categories.id', '=', 'items.sub_category_id')->join('brands', 'brands.id', '=', 'items.brand_id')->join('divisions', 'divisions.id', '=', 'items.division_id')->get();
     $pluckdata = [];
     foreach ($items as $item) {
         $data[0] = $item->category_long;
         $data[1] = $item->category;
         $data[2] = $item->sku_code;
         $data[3] = $item->barcode;
         $data[4] = $item->description;
         $data[5] = $item->description_long;
         $data[6] = $item->conversion;
         $data[7] = $item->sub_category;
         $data[8] = $item->brand;
         $data[9] = $item->division;
         $data[10] = $item->lpbt;
         if ($item->active == '1') {
             $data[11] = 'Active';
         } else {
             $data[11] = 'In-active';
         }
         $pluckdata[] = $data;
     }
     $writer->addRows($pluckdata);
     // add multiple rows at a time
     $writer->close();
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:34,代码来源:ExportController.php


示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $item = \App\Models\Item::find($id);
     $item->delete();
     return redirect('toDo');
 }
开发者ID:leanne-abarro,项目名称:toDo,代码行数:13,代码来源:ItemsController.php


示例10: update

 /**
  * Update the specified resource in storage.
  *
  * @param ProductRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProductRequest $request, $id)
 {
     $input = $request->all();
     $input['type'] = 'Product';
     Item::find($id)->update($input);
     return redirect()->route('product.index')->withMessage('Product has been Updated')->withStatus('success');
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:14,代码来源:ProductController.php


示例11: show

 public function show($id)
 {
     $invoice = Invoice::getInvoiceDetails($id);
     $items = Item::all();
     // print_r($items);
     return view('invoice', ['invoice' => $invoice, 'id' => $id, 'items' => $items->getArray()]);
 }
开发者ID:Rufio0425,项目名称:school,代码行数:7,代码来源:InvoiceController.php


示例12: actionIndex

 /**
  * Lists all BillItem models.
  * @return mixed
  */
 public function actionIndex()
 {
     if (isset($_POST['hasEditable']) && $_POST['hasEditable'] == 1) {
         \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         if (isset($_POST['item'], $_POST['quantity_user'])) {
             if (!isset(Yii::$app->session['item'])) {
                 Yii::$app->session['item'] = [];
             }
             $item = Yii::$app->session['item'];
             $item[$_POST['item']] = $_POST['quantity_user'];
             Yii::$app->session['item'] = $item;
             return ['output' => $_POST['quantity_user'], 'message' => ''];
         } else {
             return ['output' => '', 'message' => 'Validation error'];
         }
     } elseif (isset($_POST['iks'], $_POST['bks'], $_POST['assign_mode'])) {
         \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         //Create assignment
         if ($_POST['assign_mode'] == 1) {
             $items = Item::findAll($_POST['iks']);
             $bill = Bill::findOne($_POST['bks'][0]);
             $billItem = null;
             $transaction = Bill::getDb()->beginTransaction();
             try {
                 foreach ($items as $item) {
                     $billItem = BillItem::find()->where(['item_id' => $item->id, 'bill_id' => $bill->id])->one();
                     if ($billItem == null) {
                         $billItem = new BillItem();
                         $billItem->bill_id = $bill->id;
                         $billItem->item_id = $item->id;
                     }
                     $itemSession = Yii::$app->session['item'];
                     $oldQuantity = $billItem->quantity;
                     $billItem->quantity = $itemSession[$item->id];
                     if ($oldQuantity > $billItem->quantity) {
                         $item->quantity += $billItem->quantity;
                     } elseif ($oldQuantity < $billItem->quantity) {
                         $item->quantity -= $billItem->quantity;
                     }
                     $item->save(false);
                     if (!$billItem->save(false)) {
                         throw new Exception(Yii::t('app', 'Error saving {model}: {msj}', ['model' => Yii::t('app', ucfirst($billItem->tableName())), 'msj' => print_r($billItem->getErrors(), true)]), 500);
                     }
                 }
                 $transaction->commit();
                 Yii::$app->session['item'] = [];
                 return ['error' => false, 'message' => Yii::t('app', 'Saved')];
             } catch (\Exception $e) {
                 $transaction->rollBack();
                 return ['error' => true, 'message' => print_r($e, true)];
             }
         }
     }
     $searchModel = new BillSearch();
     $dataProvider = $searchModel->searchWithItem(Yii::$app->request->queryParams);
     $itemSearchModel = new ItemSearch();
     $itemDataProvider = $itemSearchModel->searchWithItem(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'itemSearchModel' => $itemSearchModel, 'itemDataProvider' => $itemDataProvider]);
 }
开发者ID:edarkzero,项目名称:mi_taller,代码行数:63,代码来源:ItemAssignController.php


示例13: save

 /**
  * 新商品
  */
 public function save()
 {
     $item = new Item();
     $item->cat_id = Input::get('cat_id');
     $item->name = Input::get('name');
     $item->sku = Input::get('sku');
     $item->price = Input::get('price');
     $destinationPath = "";
     $fileName = date('');
     if (Request::hasFile('logo')) {
         $file = Request::file('logo');
         Request::file('photo')->move($destinationPath, $fileName);
     }
     var_dump($file);
     exit;
     $item->save();
 }
开发者ID:cdandy,项目名称:artup,代码行数:20,代码来源:ItemController.php


示例14: run

 public function run()
 {
     $i = 0;
     do {
         Item::create(['name' => $i . '-item', 'completed' => false]);
         $i++;
     } while ($i <= 10);
 }
开发者ID:emsdog,项目名称:lumen-todo,代码行数:8,代码来源:ItemTableSeeder.php


示例15: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $item = Item::whereId($id)->first();
     if (empty($item)) {
         return $this->saveResponse(false);
     }
     return $this->saveResponse($item->delete());
 }
开发者ID:nq2916,项目名称:savings,代码行数:14,代码来源:ItemController.php


示例16: handle

 /**
  * Handle the command.
  *
  * @param  CreateItemCommand  $command
  * @return boolean
  */
 public function handle(CreateItemCommand $command)
 {
     $item = Item::create(['category_id' => $command->category_id, 'title' => $command->title, 'description' => $command->description, 'extra_description' => $command->extra_description, 'amount' => $command->amount, 'switch' => (int) $command->switch]);
     if (!empty($item)) {
         return $item;
     }
     return false;
 }
开发者ID:nq2916,项目名称:savings,代码行数:14,代码来源:CreateItemCommandHandler.php


示例17: indexAction

 public function indexAction($test = null)
 {
     $items = Item::find();
     // throw new ApiException('fuck!');
     $this->setMessage(':D');
     $this->setError('D:');
     return $items;
 }
开发者ID:ivyhjk,项目名称:phalcon-app,代码行数:8,代码来源:IndexController.php


示例18: remove

 public function remove()
 {
     // Get task
     $listItem = $this->getTask();
     // Remove task
     Item::find($listItem)->delete();
     return redirect()->back();
 }
开发者ID:emsdog,项目名称:lumen-todo,代码行数:8,代码来源:ListController.php


示例19: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $request = Topup::find($id);
     $items = Item::lists('name', 'id');
     $item = $request->item_id;
     $testCategories = TestCategory::lists('name', 'id');
     $testCategory = $request->test_category_id;
     return view('inventory.request.edit')->with('testCategories', $testCategories)->with('items', $items)->with('item', $item)->with('request', $request)->with('testCategory', $testCategory);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:15,代码来源:TopupController.php


示例20: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validation_rules($request);
     $itemUpdate = $request->input();
     $item = Item::find($id);
     $item->update($itemUpdate);
     Session::flash('flash_message', 'Data item layanan berhasil diupdate!');
     return redirect('admin/item');
 }
开发者ID:thesaputra,项目名称:xyz-prx,代码行数:16,代码来源:ItemController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP models\Language类代码示例发布时间:2022-05-23
下一篇:
PHP models\InvoiceDesign类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap