fix order shipped basket as empty on DB
This commit is contained in:
parent
279f0f40f9
commit
7c4fffd25e
1 changed files with 30 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Shop\Order;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixShippedBasketOnOrders extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Order::query()->get()->each(function (Order $order) {
|
||||
$order->shipped_basket = $order->shipped_basket ?? [];
|
||||
$order->saveQuietly();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
// Dont do anything.
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue