/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $arr = json_decode($this->items);
     foreach ($arr as $item) {
         \App\Inventory::create(['name' => $item->name, 'quantity_on_hand' => $item->quantityOnHand, 'updated_at' => $item->updated_at, 'par' => $item->par, 'measurement' => $item->measurement]);
     }
 }
Esempio n. 2
0
 public function addInventory($inventory)
 {
     $inventory['product_id'] = $this->id;
     \App\Inventory::create($inventory);
     return;
 }
 public function saveInventory()
 {
     $attributes = Input::all();
     $result = Inventory::create($attributes);
     if ($result) {
         return redirect()->action('HomeController@getInventory');
     }
 }