parent
d68b166e15
commit
4644f3832b
modules/Mailgateway
|
@ -39,6 +39,8 @@ class MailgatewayServiceProvider extends ServiceProvider
|
|||
MailmanType::class,
|
||||
]));
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
|
||||
|
||||
View::addNamespace('mailgateway', __DIR__ . '/Components');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Modules\Mailgateway\Types\MailmanType;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
foreach (DB::table('mailgateways')->get() as $gateway) {
|
||||
$type = json_decode($gateway->type);
|
||||
|
||||
$newType = ['type' => $type->cls, 'data' => $type->params];
|
||||
if (str_contains($type->cls, 'MailmanType')) {
|
||||
$newType['type'] = MailmanType::class;
|
||||
}
|
||||
DB::table('mailgateways')->where('id', $gateway->id)->update(['type' => json_encode($newType)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue