id(); $table->string('account', 50)->unique()->comment('账号'); // 账号,唯一 $table->string('nickname', 50)->comment('昵称'); // 昵称 $table->string('password')->comment('密码'); // 密码 $table->tinyInteger('status')->default(1)->comment('状态:0-禁用,1-启用'); // 状态 $table->timestamps(); $table->index('account'); $table->index('status'); }); // 在表创建后插入超级管理员数据 DB::table('admin')->insert([ 'account' => 'admin', 'nickname' => '超级管理员', 'password' => Hash::make('123456'), // 请修改这个默认密码 'status' => 1, 'created_at' => now(), 'updated_at' => now(), ]); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('admin'); } };