Created migration to change actual status

This commit is contained in:
noah.lancien 2023-04-06 08:56:20 +00:00
parent 4d37a18bae
commit 90d3a6f8e6

View file

@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class ChangeTicketsStatus extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$tickets = DB::table('tickets')->get();
collect($tickets)->map(function (object $ticket) {
switch ($ticket->status) {
case 3:
DB::table('tickets')->where('id', $ticket->id)
->update(['status' => 18]);
break;
case 4:
DB::table('tickets')->where('id', $ticket->id)
->update(['status' => 18]);
break;
case 5:
DB::table('tickets')->where('id', $ticket->id)
->update(['status' => 18]);
break;
case 7:
DB::table('tickets')->where('id', $ticket->id)
->update(['status' => 18]);
break;
case 10:
DB::table('tickets')->where('id', $ticket->id)
->update(['status' => 13]);
break;
default:
break;
} //end switch
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}