feat: permissions

This commit is contained in:
JaguarJack
2022-12-07 19:28:57 +08:00
parent a1d9468a91
commit 8c537e6656
45 changed files with 1030 additions and 372 deletions

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -15,18 +14,18 @@ return new class extends Migration
{
Schema::create('jobs', function (Blueprint $table) {
$table->increments('id');
$table->string('job_name', 50)->comment('岗位名称');
$table->string('coding', 30)->nullable()->comment('创建人ID');
$table->tinyInteger('status')->default('1')->comment('1 正常 2 停用');
$table->integer('sort')->default('1')->comment('排序');
$table->string('description', 1000)->nullable()->comment('岗位描述');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();
$table->string('job_name', 50)->comment('岗位名称');
$table->string('coding', 30)->nullable()->comment('创建人ID');
$table->tinyInteger('status')->default('1')->comment('1 正常 2 停用');
$table->integer('sort')->default('1')->comment('排序');
$table->string('description', 1000)->nullable()->comment('岗位描述');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();
$table->engine='InnoDB';
$table->comment('岗位表');
$table->engine = 'InnoDB';
$table->comment('岗位表');
});
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('departments', function (Blueprint $table) {
$table->increments('id');
$table->integer('parent_id')->default(0)->comment('父级ID');
$table->string('department_name')->comment('部门名称');
$table->string('principal')->nullable()->comment('负责人');
$table->string('mobile', 30)->nullable()->comment('负责人联系方式');
$table->string('email', 50)->nullable()->comment('邮箱');
$table->smallInteger('status')->default(1)->comment('1 正常 2 停用');
$table->integer('sort')->default(1)->comment('排序');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();
$table->engine = 'InnoDB';
$table->comment('部门表');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('departments');
}
};

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id');
$table->string('permission_name', 30)->comment('菜单名称');
$table->integer('parent_id')->default('1')->comment('父级菜单');
$table->string('route', 50)->comment('路由');
$table->string('icon', 50)->comment('菜单 icon');
$table->string('module', 50)->comment('所属模块');
$table->string('permission_mark')->comment('权限标识');
$table->string('component')->comment('组件');
$table->string('redirect')->comment('组件跳转');
$table->tinyInteger('keepalive')->default('1')->comment('1 缓存 2 不缓存');
$table->tinyInteger('type')->default('1')->comment('1 菜单 2 按钮');
$table->tinyInteger('hidden')->default('1')->comment('1 显示 2 隐藏');
$table->integer('sort')->default('1')->comment('排序');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();
$table->engine = 'InnoDB';
$table->comment('权限模块');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('permissions');
}
};

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id');
$table->integer('parent_id')->default(0)->comment('父级菜单');
$table->string('permission_name', 50)->comment('菜单名称');
$table->string('route', 50)->comment('前端路由');
$table->string('icon', 50)->comment('菜单 icon');
$table->string('module', 50)->comment('所属模块');
$table->string('permission_mark', 100)->comment('权限标识,使用 @ 分割');
$table->string('component')->comment('组件');
$table->string('redirect')->nullable()->comment('跳转地址');
$table->tinyInteger('keepalive')->default('1')->comment('1 缓存 2 不缓存');
$table->tinyInteger('type')->default('1')->comment('1 目录 2 菜单 3 按钮');
$table->tinyInteger('hidden')->default('1')->comment('1 显示 2 隐藏');
$table->integer('sort')->default('1')->comment('排序');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();
$table->engine = 'InnoDB';
$table->comment('权限表');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('permissions');
}
};