Skip to content

Commit

Permalink
Correct CategoriesController.edit()
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Jan 25, 2024
1 parent 8943885 commit dffb676
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/Http/Controllers/Adm/Forum/CategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Boduch\Grid\Source\CollectionSource;
use Coyote\Events\ForumSaved;
use Coyote\Forum;
use Coyote\Http\Controllers\Adm\BaseController;
use Coyote\Http\Forms\Forum\ForumForm;
use Coyote\Http\Grids\Adm\Forum\CategoriesGrid;
Expand Down Expand Up @@ -45,10 +46,15 @@ public function index(): View
return $this->view('adm.forum.categories.home')->with('grid', $grid);
}

public function edit(?int $id): View
public function edit(int $id = null): View
{
$forum = $this->forum->findOrNew($id);
$this->breadcrumb->push($forum->name ?? 'Dodaj nową', route('forum.category', ['forum' => $forum]));
if ($id) {
$forum = $this->forum->findOrNew($id);
$this->breadcrumb->push($forum->name, route('forum.category', ['forum' => $forum]));
} else {
$forum = new Forum;
$this->breadcrumb->push('Dodaj nową', route('adm.forum.categories.save'));
}

return $this->view('adm.forum.categories.save')->with('form', $this->getForm($forum));
}
Expand Down

0 comments on commit dffb676

Please sign in to comment.