id('id')->primary()->autoIncrement(); $table->string('name', 50)->unique()->comment('角色名称'); $table->string('display_name', 100)->comment('显示名称'); $table->text('description')->nullable()->comment('角色描述'); $table->string('guard_name', 50)->default('web')->comment('守卫名称'); $table->boolean('is_active')->default(true)->comment('是否激活'); $table->integer('sort_order')->default(0)->comment('排序'); $table->timestamp('created_at')->useCurrent()->comment('创建时间'); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->comment('更新时间'); // 索引 $table->index('name'); $table->index('guard_name'); $table->index('is_active'); $table->index('sort_order'); }); } public function down(): void { Schema::dropIfExists('roles'); } }