public function store(Request $request)
{
$product=new Product;
$product->name=$request['name'];
$product->qty=$request['qty'];
$product->save();
$collection=Collection::findorfail(relationid)
$collection_qty=$collection->qty;
$collection->update([
'qty'=> $collection_qty-$request->qty
])
}
0 Comments