foreach ($products as $v=>$a)
{
$count[] = array('product_name' => $a['name'], 'product_weight' => $a['weight'], 'product_id' => $a['pid'], 'product_price' => $a['price'], 'order_id' => $order->id, 'card_phone' => $user->phone);
}
CountOrder::insert($count);
When using laravel to insert data in batches,
The creation time of the inserted data is all 0000000;
How to save the creation time and update time fields normally? Do they also need to be written in the array?
In fact, you can use save()
My laravel tutorial column: /u/biaoyansu/blogs
Laravel maintains created_at updated_at by default and needs to be declared in the model public $timestamps = false; the default is true