<?php

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

class AddAuthorityDataDelivery extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $authorities = \App\Authority::query()->where("alias_name","like","%客户预约%")->get();
        foreach ($authorities as $authority){
            $name = str_replace("客户预约","入库预约",$authority->alias_name);
            $authority->update(["name"=>$name,"alias_name"=>$name]);
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $authorities = \App\Authority::query()->where("alias_name","like","%客户预约%")->get();
        foreach ($authorities as $authority){
            $name = str_replace("入库预约","客户预约",$authority->alias_name);
            $authority->update(["name"=>$name,"alias_name"=>$name]);
        }
    }
}
