<?php

use Illuminate\Database\Seeder;

class OptionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        \App\Models\Option::truncate();
        $table = 'orders';
        $column = 'status';
        $items = [
            ['name' => '待审核', 'key' => 'checking', 'color' => 'rgba(234, 151, 14, 1)'],
            ['name' => '已审核', 'key' => 'checked', 'color' => 'rgba(76, 173, 132, 1)'],
            ['name' => '已完成', 'key' => 'pass', 'color' => 'rgba(25, 133, 251, 1)'],
            ['name' => '已驳回', 'key' => 'reject', 'color' => 'rgba(225, 132, 132, 1)'],
            ['name' => '已归还', 'key' => 'back', 'color' => 'rgb(114, 50, 221)'],
        ];
        \App\Models\Option::where([
            ['table', '=', $table],
            ['column', '=', $column]
        ])->delete();
        foreach($items as $key => $val) {
            \App\Models\Option::create([
                'table' => $table,
                'column' => $column,
                'name' => $val['name'],
                'key' => $val['key'],
                'sort' => $key + 1,
                'color' => $val['color']
            ]);
        }
    }
}
