<?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 $key => $route) {
            $data = ['id' => $route['id'], 'name' => $key, 'guard_name' => 'api'];
            Permission::firstOrCreate($data);
        }
    }
}
