<?php

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

class AddUnitsData extends Migration
{
    protected $units = [
        "件","箱",'单',"日","月","m²","m³","件","托"
    ];
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        foreach ($this->units as $unit){
            \App\Unit::query()->firstOrCreate(["name"=>$unit]);
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
    }
}
