<?php

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

class AddAuthorityToCustomerOwner extends Migration
{
    public $addAuthorities = [
        "客户管理-项目-停用",
    ];
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        foreach ($this->addAuthorities as $authority){
            \App\Authority::query()->firstOrCreate([
                "name"=>$authority
            ],[
                "name"=>$authority,
                "alias_name"=>$authority
            ]);
        }
    }

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