Skip to content

[BUG] 增加菜单字段为parent_id并非pid #554

Description

@corin11

原代码

 'pid' => $model->id,

正确代码

MenuService.php

    public function create(array $data): Menu
    {
        /**
         * @var Menu $model
         */
        $model = parent::create($data);
        if ($data['meta']['type'] === 'M' && ! empty($data['btnPermission'])) {
            foreach ($data['btnPermission'] as $item) {
                $this->repository->create([
                    'parent_id' => $model->id,
                    'name' => $item['code'],
                    'sort' => 0,
                    'status' => 1,
                    'meta' => [
                        'title' => $item['title'],
                        'i18n' => $item['i18n'],
                        'type' => 'B',
                    ],
                ]);
            }
        }
        return $model;
    }

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions