💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
1.创建数据填充文件。 ``` php artisan module:make-seed auths_table_seeder AuthAdmin ``` ![](https://img.kancloud.cn/65/41/65417b9cd0c36e433359f39ccac151d4_1227x164.png) ![](https://img.kancloud.cn/e3/2a/e32a613fa5c0c943589837766cc77997_1064x293.png) 2.修改数据填充文件。 ``` <?php namespace Modules\AuthAdmin\Database\Seeders; use Illuminate\Support\Facades\DB; use Illuminate\Database\Seeder; use Illuminate\Database\Eloquent\Model; class AuthsTableSeederTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $group_id = DB::table('auth_groups')->insertGetId([ 'title' => '超级管理员', 'created_at'=>date('Y-m-d H:i:s'), 'rules'=>'1|2']); DB::table('auth_admins')->insert([ 'username' => 'admin', 'password' => bcrypt('123456'), 'group_id' => $group_id, 'created_at'=>date('Y-m-d H:i:s') ]); DB::table('auth_rules')->insert([ 'href' => 'admin.index.index', 'title'=>'后台首页', 'status'=>0, 'auth_open'=>0, 'icon'=>'', 'pid'=>0, 'created_at'=>date('Y-m-d H:i:s') ]); DB::table('auth_rules')->insert([ 'href' => 'admin.index.clear', 'title'=>'清除缓存', 'status'=>0, 'auth_open'=>0, 'icon'=>'', 'pid'=>0, 'created_at'=>date('Y-m-d H:i:s') ]); } } ``` ``` <?php namespace Modules\AuthAdmin\Database\Seeders; use Illuminate\Database\Seeder; use Illuminate\Database\Eloquent\Model; class AuthAdminDatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $this->call(AuthsTableSeederTableSeeder::class); } } ``` 3.执行数据填充文件。 ``` php artisan module:seed AuthAdmin ``` 视频链接 ```[youku] XNDU0MDI4MDc0MA ```