12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- use Kalnoy\Nestedset\NestedSet;
- return new class extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('admin_user_level', function (Blueprint $table) {
- //主键ID
- $table->id();
- //备注
- $table->string('remark')->default('');
- //在此添加此方法,nestedset将会自动生成:_lft、_rgt、parent_id三个字段
- NestedSet::columns($table);
- //根据实际场景需要决定需不需要软删除
- $table->softDeletes();
- //添加创建时间、更新时间字段
- $table->timestamps();
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('admin_user_level');
- }
- };
|