Skip to content

Commit

Permalink
Merge pull request #1454 from moonshine-software/home-url
Browse files Browse the repository at this point in the history
feat: Config home url
  • Loading branch information
lee-to authored Jan 9, 2025
2 parents 21bf804 + 234dd5c commit 4241832
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Laravel/src/DependencyInjection/MoonShineConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,16 @@ public function homeRoute(string|Closure $route): self
return $this->set('home_route', $route);
}

public function getHomeUrl(): ?string
{
return $this->get('home_url');
}

public function homeUrl(string|Closure $route): self
{
return $this->set('home_url', $route);
}

public function getAuthorizationRules(): Collection
{
return $this->authorizationRules;
Expand Down
4 changes: 4 additions & 0 deletions src/Laravel/src/MoonShineEndpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ public function toPage(

public function home(): string
{
if ($url = moonshineConfig()->getHomeUrl()) {
return $url;
}

return route(
moonshineConfig()->getHomeRoute()
);
Expand Down

0 comments on commit 4241832

Please sign in to comment.