コード例 #1
0
 public function save(Request $request)
 {
     $products = $request->get('product_id');
     $stock = Stock::create($request->all());
     foreach ($products as $product) {
         StockProducts::create(['product_id' => $product, 'stock_id' => $stock->id]);
     }
     return view('pages.home');
 }