<?php

use App\Authority;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAuthoritiesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('authorities', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->unique();
            $table->string('alias_name')->nullable();
            $table->string('remark')->nullable();
            $table->bigInteger('id_parent')->index()->nullable();
            $table->timestamps();
        });
        (new Authority(['name'=>'基础设置','alias_name'=>'基础设置']))->save();
        (new Authority(['name'=>'权限','alias_name'=>'权限']))->save();
        (new Authority(['name'=>'权限-查询','alias_name'=>'权限-查询']))->save();
        (new Authority(['name'=>'权限-录入','alias_name'=>'权限-录入']))->save();
        (new Authority(['name'=>'权限-编辑','alias_name'=>'权限-编辑']))->save();
        (new Authority(['name'=>'权限-删除','alias_name'=>'权限-删除']))->save();
        (new Authority(['name'=>'物流公司','alias_name'=>'物流公司']))->save();
        (new Authority(['name'=>'物流公司-查询','alias_name'=>'物流公司-查询']))->save();
        (new Authority(['name'=>'物流公司-录入','alias_name'=>'物流公司-录入']))->save();
        (new Authority(['name'=>'物流公司-编辑','alias_name'=>'物流公司-编辑']))->save();
        (new Authority(['name'=>'物流公司-删除','alias_name'=>'物流公司-删除']))->save();
        (new Authority(['name'=>'货主','alias_name'=>'货主']))->save();
        (new Authority(['name'=>'货主-查询','alias_name'=>'货主-查询']))->save();
        (new Authority(['name'=>'货主-录入','alias_name'=>'货主-录入']))->save();
        (new Authority(['name'=>'货主-编辑','alias_name'=>'货主-编辑']))->save();
        (new Authority(['name'=>'货主-删除','alias_name'=>'货主-删除']))->save();
        (new Authority(['name'=>'货主-可见全部','alias_name'=>'货主-可见全部']))->save();
        (new Authority(['name'=>'品质标签','alias_name'=>'品质标签']))->save();
        (new Authority(['name'=>'品质标签-查询','alias_name'=>'品质标签-查询']))->save();
        (new Authority(['name'=>'品质标签-录入','alias_name'=>'品质标签-录入']))->save();
        (new Authority(['name'=>'品质标签-编辑','alias_name'=>'品质标签-编辑']))->save();
        (new Authority(['name'=>'品质标签-删除','alias_name'=>'品质标签-删除']))->save();
        (new Authority(['name'=>'角色','alias_name'=>'角色']))->save();
        (new Authority(['name'=>'角色-查询','alias_name'=>'角色-查询']))->save();
        (new Authority(['name'=>'角色-录入','alias_name'=>'角色-录入']))->save();
        (new Authority(['name'=>'角色-编辑','alias_name'=>'角色-编辑']))->save();
        (new Authority(['name'=>'角色-删除','alias_name'=>'角色-删除']))->save();
        (new Authority(['name'=>'用户','alias_name'=>'用户']))->save();
        (new Authority(['name'=>'用户-查询','alias_name'=>'用户-查询']))->save();
        (new Authority(['name'=>'用户-录入','alias_name'=>'用户-录入']))->save();
        (new Authority(['name'=>'用户-编辑','alias_name'=>'用户-编辑']))->save();
        (new Authority(['name'=>'用户-删除','alias_name'=>'用户-删除']))->save();
        (new Authority(['name'=>'日志','alias_name'=>'日志']))->save();
        (new Authority(['name'=>'日志-查询','alias_name'=>'日志-查询']))->save();
        (new Authority(['name'=>'日志-录入','alias_name'=>'日志-录入']))->save();
        (new Authority(['name'=>'日志-编辑','alias_name'=>'日志-编辑']))->save();
        (new Authority(['name'=>'日志-删除','alias_name'=>'日志-删除']))->save();
        (new Authority(['name'=>'退货管理','alias_name'=>'退货管理']))->save();
        (new Authority(['name'=>'退货管理-相关设置','alias_name'=>'退货管理-相关设置']))->save();
        (new Authority(['name'=>'退货管理-查询','alias_name'=>'退货管理-查询']))->save();
        (new Authority(['name'=>'退货管理-录入','alias_name'=>'退货管理-录入']))->save();
        (new Authority(['name'=>'退货管理-编辑','alias_name'=>'退货管理-编辑']))->save();
        (new Authority(['name'=>'退货管理-删除','alias_name'=>'退货管理-删除']))->save();
        (new Authority(['name'=>'退货管理-审核','alias_name'=>'退货管理-审核']))->save();
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('authorities');
    }
}
