首页 > 代码库 > yii\rbac\DbManager:addItem($item) 插入auth_item权限项目表 设置时间

yii\rbac\DbManager:addItem($item) 插入auth_item权限项目表 设置时间

    protected function addItem($item)
    {
        $time = time();
        if ($item->createdAt === null) {
            $item->createdAt = $time;
        }
        if ($item->updatedAt === null) {
            $item->updatedAt = $time;
        }
        $this->db->createCommand()
            ->insert($this->itemTable, [ //auth_item
                ‘name‘ => $item->name,
                ‘type‘ => $item->type,
                ‘description‘ => $item->description,
                ‘rule_name‘ => $item->ruleName,
                ‘data‘ => $item->data =http://www.mamicode.com/== null ? null : serialize($item->data),
                ‘created_at‘ => $item->createdAt,
                ‘updated_at‘ => $item->updatedAt,
            ])->execute();

        $this->invalidateCache();

        return true;
    }

 

yii\rbac\DbManager:addItem($item) 插入auth_item权限项目表 设置时间