show the chat again
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Chat;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Chat::unguard();
|
||||
\App\Models\Chat::all()->each(function (Chat $chat) {
|
||||
$newType = match($chat->chatable_type) {
|
||||
\App\Models\Mutation::class => 'mutation',
|
||||
\App\Models\Ledger::class => 'ledger',
|
||||
\App\Models\Dynamic::class => 'dynamic',
|
||||
default => $chat->chatable_type,
|
||||
};
|
||||
$chat->update(['chatable_type' => $newType]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user