Skip to content

Commit

Permalink
Extract method for the base authors route key
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 12, 2024
1 parent 5525c48 commit 4aa6f82
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ public static function generateAuthorPages(): array
->prepend(new PostAuthorsPage($authors))
->all();
}

public static function authorBaseRouteKey(): string
{
// Todo: Allow customizing this

return 'authors';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Hyde\Pages\InMemoryPage;
use Hyde\Framework\Features\Blogging\Models\PostAuthor;
use Hyde\Framework\Features\Blogging\DynamicBlogPostPageHelper;

/**
* @experimental
Expand All @@ -18,7 +19,7 @@ class PostAuthorPage extends InMemoryPage

public function __construct(PostAuthor $author)
{
parent::__construct("authors/$author->username");
parent::__construct(DynamicBlogPostPageHelper::authorBaseRouteKey()."/$author->username");
}

public function getBladeView(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Hyde\Pages\InMemoryPage;
use Illuminate\Support\Collection;
use Hyde\Framework\Features\Blogging\DynamicBlogPostPageHelper;

/**
* @experimental
Expand All @@ -19,7 +20,7 @@ class PostAuthorsPage extends InMemoryPage

public function __construct(Collection $authors)
{
parent::__construct('authors');
parent::__construct(DynamicBlogPostPageHelper::authorBaseRouteKey());

$this->authors = $authors;
}
Expand Down

0 comments on commit 4aa6f82

Please sign in to comment.