<?php

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

use Illuminate\Support\Facades\Auth;

class AddConfigurationsData extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $time=\Illuminate\Support\Carbon::now()->toDateTimeString();
        $configurations = [];
        $conf_one=['name'=>'price_coefficient','value'=>1.3,'description'=>'采购管理价格系数','operator'=>Auth::user()['id'],'created_at'=>$time,'updated_at'=>$time];
        $conf_two=['name'=>'enquiry_time','value'=>4,'description'=>'报价需在询价发起延时时间之内有效','operator'=>Auth::user()['id'],'created_at'=>$time,'updated_at'=>$time];
        $conf_three=['name'=>'receive_time','value'=>24,'description'=>'接单需在询价发起延时时间之内有效','operator'=>Auth::user()['id'],'created_at'=>$time,'updated_at'=>$time];
        $configurations[]=$conf_one;
        $configurations[]=$conf_two;
        $configurations[]=$conf_three;
        Configuration::query()->insert($configurations);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Configuration::query()->where('name','价格系数')->delete();
        Configuration::query()->where('name','询价延时时间')->delete();
        Configuration::query()->where('name','接单延时时间')->delete();
    }
}
