Enhance MigrationController and ShieldSeeder for improved data migration and role management

- 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.
This commit is contained in:
Mekan1206
2025-12-21 20:58:10 +05:00
parent 749208ac97
commit a5bc322170
4 changed files with 92 additions and 7 deletions

View File

@@ -0,0 +1,26 @@
<?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');");
}
}