Skip to content

Commit

Permalink
fix(MenuService): update create method to return Menu type and correc…
Browse files Browse the repository at this point in the history
…t parent_id reference (#560)

Close: #554
  • Loading branch information
People-Sea authored Mar 11, 2025
1 parent 7c2eede commit ab9076e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Service/Permission/MenuService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ public function getRepository(): MenuRepository
return $this->repository;
}

public function create(array $data): mixed
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([
'pid' => $model->id,
'parent_id' => $model->id,
'name' => $item['code'],
'sort' => 0,
'status' => 1,
Expand Down

0 comments on commit ab9076e

Please sign in to comment.