<?php

use App\Authority;
use Illuminate\Database\Migrations\Migration;

class CreateDemandAuthorities extends Migration
{

    private $authorities = [
        '需求管理-问题-删除'
    ];

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        foreach ($this->authorities as $name){
            Authority::query()->firstOrCreate(
                ['name' => $name],
                ['name' => $name,'alias_name' => $name]
            );
        }
    }

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

    }
}
