<?php

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

class AddStationRuleBatchAuthor extends Migration
{
    public $names = [
        '站管理-站规则',
        '站管理-站规则-编辑',
        '站管理-站规则-创建',
        '站管理-站规则-删除',
    ];
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        foreach ($this->names as $item) {
            \App\Authority::query()->firstOrCreate(['name' => $item],['alias_name' => $item]);
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        foreach ($this->names as $item) {
            \App\Authority::query()->where('name' , $item)->delete();
        }
    }
}
