bigIncrements('id'); // permission id $table->string('name', 50)->comment('菜单名称'); $table->tinyInteger('type')->comment('菜单类型'); $table->integer('sort')->default(0)->comment('显示顺序'); $table->bigInteger('parent_id')->default(0)->comment('父菜单ID'); $table->string('path', 200)->nullable()->comment('路由地址'); $table->string('icon', 100)->nullable()->comment('菜单图标'); $table->string('component')->nullable()->comment('组件路径'); $table->string('component_name')->nullable()->comment('组件名'); $table->tinyInteger('status')->default(0)->comment('菜单状态'); $table->tinyInteger('visible')->default(1)->comment('是否可见'); $table->tinyInteger('keep_alive')->default(1)->comment('是否缓存'); $table->tinyInteger('always_show')->default(1)->comment('是否总是显示'); $table->string('creator', 64)->nullable()->comment('创建者'); $table->string('updater', 64)->nullable()->comment('更新者'); $table->timestamps(); }); Schema::create('system_role_has_menus', function (Blueprint $table) use ($tableNames) { $table->bigIncrements('id'); $table->unsignedBigInteger('menu_id'); $table->unsignedBigInteger('role_id'); $table->foreign('menu_id') ->references('id') ->on('system_menus') ->onDelete('cascade'); $table->foreign('role_id') ->references('id') ->on($tableNames['roles']) ->onDelete('cascade'); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('system_role_has_menus'); Schema::dropIfExists('system_menus'); } };