Skip to content

Commit

Permalink
fix(cs-fix): fix cs-fix error (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanyxmo authored Nov 15, 2024
1 parent 30644a8 commit d742aa0
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions app/Service/Permission/MenuService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,22 @@ public function updateById(mixed $id, array $data): mixed
{
$model = parent::updateById($id, $data);
if ($model && $data['meta']['type'] === 'M' && ! empty($data['btnPermission'])) {
foreach ($data['btnPermission'] as $item) if (! empty($item['type']) && $item['type'] === 'B') {
$data = [
'name' => $item['code'],
'meta' => [
'title' => $item['title'],
'i18n' => $item['i18n'],
'type' => 'B',
],
];
if (! empty($item['id'])) {
$this->repository->updateById($item['id'], $data);
} else {
$data['parent_id'] = $id;
$this->repository->create($data);
foreach ($data['btnPermission'] as $item) {
if (! empty($item['type']) && $item['type'] === 'B') {
$data = [
'name' => $item['code'],
'meta' => [
'title' => $item['title'],
'i18n' => $item['i18n'],
'type' => 'B',
],
];
if (! empty($item['id'])) {
$this->repository->updateById($item['id'], $data);
} else {
$data['parent_id'] = $id;
$this->repository->create($data);
}
}
}
}
Expand Down

0 comments on commit d742aa0

Please sign in to comment.