Skip to content

Commit

Permalink
Updated redirects when create/update/delete section
Browse files Browse the repository at this point in the history
  • Loading branch information
simba77 committed Feb 10, 2024
1 parent d3e4f44 commit ff1d86d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Controllers/Admin/ContentSectionsController.php
Expand Up @@ -98,7 +98,7 @@ public function create(int $type, ?int $sectionId, Request $request, ContentSect
$values['content_type_id'] = $type;
ContentSection::query()->create($values);
$this->session->flash('message', __('The Section was Successfully Created'));
return new RedirectResponse(route('content.admin.sections', ['type' => $type]));
return new RedirectResponse(route('content.admin.sections', ['sectionId' => $sectionId, 'type' => $type]));
} catch (ValidationException $validationException) {
return (new RedirectResponse(route('content.admin.sections.create', ['sectionId' => $sectionId, 'type' => $type])))
->withPost()
Expand Down Expand Up @@ -140,7 +140,7 @@ public function edit(int $id, Request $request, ContentSectionForm $form): strin
$values['code'] = empty($values['code']) ? Str::slug($values['name']) : Str::slug($values['code']);
$contentSection->update($values);
$this->session->flash('message', __('The Section was Successfully Updated'));
return new RedirectResponse(route('content.admin.sections', ['type' => $contentSection->content_type_id]));
return new RedirectResponse(route('content.admin.sections', ['sectionId' => $contentSection->parent, 'type' => $contentSection->content_type_id]));
} catch (ValidationException $validationException) {
return (new RedirectResponse(route('content.admin.sections.edit', ['id' => $id])))
->withPost()
Expand All @@ -165,7 +165,7 @@ public function delete(int $type, int $id, Request $request): RedirectResponse |
if ($request->isPost()) {
$contentSection->delete();
$this->session->flash('message', __('The Section was Successfully Deleted'));
return new RedirectResponse(route('content.admin.sections', ['type' => $type]));
return new RedirectResponse(route('content.admin.sections', ['sectionId' => $contentSection->parent, 'type' => $type]));
}

$data['elementName'] = $contentSection->name;
Expand Down

0 comments on commit ff1d86d

Please sign in to comment.