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


PHP Stock::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Stock::$rules);
     if ($validation->passes()) {
         $this->stock->create($input);
         return Redirect::route('stocks.index');
     }
     return Redirect::route('stocks.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
 }
开发者ID:maldewar,项目名称:jidou,代码行数:15,代码来源:StocksController.php

示例2: addAction

 public function addAction()
 {
     // create a new model instance
     ////////////////////////////////////////////////////////////
     $xi = 0;
     if (Input::has('index')) {
         $xi = Input::get("index");
     }
     /////////////////////////////////////////////////////////////
     $stockObjnew = new Stock();
     if ($stockObjnew->isPosted()) {
         $new = Input::all();
         // attempt validation
         if ($stockObjnew->validate($xi, $new, 1)) {
             $object = Stock::create([Stock::$FieldsName[Stock::$FieldsOrderCreate['1']] => Input::get($this->FieldsCreate['1']['name'] . $xi), Stock::$FieldsName[Stock::$FieldsOrderCreate['2']] => Input::get($this->FieldsCreate['2']['name'] . $xi), Stock::$FieldsName[Stock::$FieldsOrderCreate['3']] => Input::get($this->FieldsCreate['3']['name'] . $xi)]);
             return Response::json(['success' => true, 'iddelrow' => Input::get('index')]);
         } else {
             $this->errors = $stockObjnew->errors();
             $this->addrow = $this->addrowAction();
             return Response::json(['success' => false, 'error' => $this->errors->toArray()]);
         }
     }
     $this->addrow = $this->addrowAction();
     $object;
     $xi = 0;
     return View::make($this->routeAdd, ["row" => $this->addrow, "FieldsCreate" => $this->FieldsCreate, "module" => $this->module, "productoCombo" => $this->productoCombo, "key" => $this->key]);
 }
开发者ID:alejandromorg,项目名称:Inventario,代码行数:27,代码来源:StockController.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Stock::create([]);
     }
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:7,代码来源:StocksTableSeeder.php

示例4: run

 public function run()
 {
     $object = [["ID_PRODUCTO" => "10", "CANTIDAD" => "101", "ID_BODEGA" => "1"], ["ID_PRODUCTO" => "20", "CANTIDAD" => "10", "ID_BODEGA" => "1"], ["ID_PRODUCTO" => "1", "CANTIDAD" => "55", "ID_BODEGA" => "1"]];
     DB::unprepared('ALTER TABLE ' . $this->table . ' AUTO_INCREMENT = 1');
     foreach ($object as $detail) {
         Stock::create($detail);
     }
 }
开发者ID:alejandromorg,项目名称:Inventario,代码行数:8,代码来源:StockSeeder.php

示例5: store

 /**
  * Store a newly created stock in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Stock::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Stock::create($data);
     return Redirect::route('stocks.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:14,代码来源:StocksController.php

示例6: saveInStockTable

 private function saveInStockTable($disminuir, $idBranch, $idArticle, $amount)
 {
     try {
         $articleStock = Stock::where('article_id', $idArticle)->where('branch_id', $idBranch)->first();
         if (!empty($articleStock)) {
             if ($disminuir == true) {
                 $articleStock->stock -= $amount;
             } else {
                 $articleStock->stock += $amount;
             }
             $articleStock->update();
         } else {
             $StockTable = new Stock();
             $stock['branch_id'] = $idBranch;
             $stock['article_id'] = $idArticle;
             $stock['stock'] = $amount;
             $stock['minstock'] = 0;
             $StockTable->create($stock);
         }
         #if
     } catch (Exception $e) {
         die('No se pudo modificar el stock del artículo' . $idArticle . ' en la sucursal ' . $idBranch);
     }
 }
开发者ID:heromdn,项目名称:inventarios,代码行数:24,代码来源:RotationController.php


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