Created migration to change actual status
This commit is contained in:
parent
4d37a18bae
commit
90d3a6f8e6
1 changed files with 53 additions and 0 deletions
|
|
@ -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()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue