Duplicate Entry when using firstOrCreate on Laravel?
问题 This is my Controller foreach ($dataOrder['items'] as $rowJubelio) { DataOrderDetailEcommerce::firstOrCreate([ 'order_id' => DataOrderEcommerce::firstOrCreate([ 'orderid'=> $invoice, 'cust_name'=> ucwords($cust_name), 'province'=> $province, 'city'=> $city, 'district'=> $area, 'zipcode'=> $zipcode, 'phone'=>$phone, 'fleet_id'=> $fleet, 'ecommerce_id'=> $ecommerce, 'date_add'=>date('Y-m-d'), 'no_resi'=> $no_resi, 'email'=> $email, 'order_time'=> $transactionDate ])->orderid, 'sku_id'=>