<?php

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

class AddWeighAuthority extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        (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()
    {
        Authority::where('name','纸箱')->delete();
        Authority::where('name','纸箱-查询')->delete();
        Authority::where('name','纸箱-录入')->delete();
        Authority::where('name','纸箱-编辑')->delete();
        Authority::where('name','纸箱-删除')->delete();
        Authority::where('name','测量设备')->delete();
        Authority::where('name','测量设备-查询')->delete();
        Authority::where('name','测量设备-录入')->delete();
        Authority::where('name','测量设备-编辑')->delete();
        Authority::where('name','测量设备-删除')->delete();
    }
}
