<?php

use Illuminate\Database\Seeder;

class RightSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $items = [
            ['name' => '租赁订单申请权限', 'key' => 'rentCreate'],
            ['name' => '租赁订单操作权限', 'key' => 'rentHandle'],
            ['name' => '租赁订单审核权限', 'key' => 'rentCheck'],
            ['name' => '租赁订单金额修改权限', 'key' => 'rentMoneyChange'],
            ['name' => '租赁订单金额确认权限', 'key' => 'rentMoneyConfirm'],
            ['name' => '租赁订单查看权限', 'key' => 'rentView'],
            ['name' => '调用订单申请权限', 'key' => 'applyCreate'],
            ['name' => '调用订单操作权限', 'key' => 'applyHandle'],
            ['name' => '调用订单审核权限', 'key' => 'applyCheck'],
            ['name' => '调用订单修订权限', 'key' => 'applyEdit'],
            ['name' => '设备管理查看权限', 'key' => 'deviceView'],
            ['name' => '维修上报权限', 'key' => 'repairReport'],
            ['name' => '项目新建权限', 'key' => 'newProject'],
            ['name' => '人员添加权限', 'key' => 'memberAdd'],
            ['name' => '人员管理权限', 'key' => 'memberManage'],
            ['name' => '数据中心查看权限', 'key' => 'dataView'],
        ];
        \App\Models\Right::truncate();
        \App\Models\ProjectRoleRight::truncate();
        foreach ($items as $key => $item) {
            \App\Models\Right::create([
                'name' => $item['name'],
                'key' => $item['key'],
                'sort' => ($key + 1)
            ]);
        }
    }
}
