Esempio n. 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // create the new Order
     $order = new Order();
     // Get the data
     $order->store_id = $request->store_id;
     $order->order_date = $request->order_date;
     $order->notes = $request->notes;
     // Update the totals
     $order->updateCost();
     $order->updateRounds();
     // Save the Order
     $order->save();
     // Update inventory for all Bullets
     Bullet::updateInventory();
     session()->flash('message', 'Order has been added');
     session()->flash('message-type', 'success');
     return redirect()->action('OrderController@show', [$order->id]);
 }