<?php

use Illuminate\Database\Seeder;

class ProjectRoleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $roles = [
            ['name' => '工区负责人', 'key' => 'work', 'need_check' => 2, 'need_check_inner' => 2],
            ['name' => '机电负责人', 'key' => 'machine', 'need_check' => 1, 'need_check_inner' => 2],
            ['name' => '项目副经理', 'key' => 'assist', 'need_check' => 1, 'need_check_inner' => 1],
            ['name' => '项目经理', 'key' => 'manager', 'need_check' => 1, 'need_check_inner' => 1],
            ['name' => '管理员子账号', 'key' => 'sub', 'need_check' => 2, 'need_check_inner' => 2],
            ['name' => '领导账号', 'key' => 'leader', 'need_check' => 2, 'need_check_inner' => 2],
            ['name' => '管理员', 'key' => 'admin', 'need_check' => 2, 'need_check_inner' => 1]
        ];

        \App\Models\ProjectRole::truncate();
        foreach ($roles as $key => $role) {
            \App\Models\ProjectRole::create([
                'name' => $role['name'],
                'level' => ($key + 1),
                'key' => $role['key'],
                'need_check' => $role['need_check'],
                'need_check_inner' => $role['need_check_inner']
            ]);
        }
    }
}
