<?php

use Illuminate\Database\Seeder;

class InnerDeviceStatusSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $table = 'inner_devices';
        $column = 'status';
        $items = [
            ['name' => '闲置中', 'key' => 'free', 'color' => '#07c160'],
            ['name' => '使用中', 'key' => 'using', 'color' => '#ee0a24'],
            ['name' => '维修', 'key' => 'repair', 'color' => '#ff976a'],
            ['name' => '报废', 'key' => 'scrap', 'color' => 'black']
        ];
        \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']
            ]);
        }
    }
}
