- Added new migrators: ModelHasRolesMigrator and OnlinePaymentsMigrator to MigrationController. - Introduced a test method in MigrationController to facilitate online payments migration. - Updated ShieldSeeder to include role IDs for better role management and added new roles with specific IDs.
26 lines
653 B
PHP
26 lines
653 B
PHP
<?php
|
|
|
|
namespace Database\Seeders\Migrators;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
class ModelHasRolesMigrator
|
|
{
|
|
public function migrate(): void
|
|
{
|
|
DB::table('model_has_roles')->truncate();
|
|
|
|
$path = database_path('data/tested/model_has_roles.json');
|
|
|
|
$rawData = File::json($path);
|
|
|
|
foreach ($rawData as $data) {
|
|
DB::table('model_has_roles')
|
|
->insert($data);
|
|
}
|
|
|
|
DB::statement("SELECT setval('model_has_roles_id_seq', (SELECT MAX(id) from model_has_roles));");
|
|
DB::statement("SELECT nextval('model_has_roles_id_seq');");
|
|
}
|
|
} |