mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
23 lines
534 B
PHP
23 lines
534 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Spatie\Permission\Models\Permission;
|
|
|
|
class PermissionsTableSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$routes = include(resource_path('lang/zh-CN/permission.php'));
|
|
foreach ($routes as $code => $route) {
|
|
$data = ['id' => $route['id'], 'name' => $code, 'guard_name' => 'api'];
|
|
Permission::firstOrCreate($data);
|
|
}
|
|
}
|
|
}
|