first init
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RolesSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$json = file_get_contents(database_path('seeders/json/roles_20251014.json'));
|
||||
$data = json_decode($json, true);
|
||||
|
||||
foreach ($data['roles'] as $role) {
|
||||
DB::table('roles')->insert(
|
||||
[
|
||||
'id' => Str::uuid(),
|
||||
'name' => $role['name'],
|
||||
'guard_name' => $role['guard_name'],
|
||||
'created_at' => $role['created_at'],
|
||||
'updated_at' => $role['updated_at'],
|
||||
'fullname' => $role['fullname'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user