From 74066dbb44b1dda2327dd2205a5315305f64ae19 Mon Sep 17 00:00:00 2001 From: LT Date: Sun, 5 Jan 2025 15:54:39 +0300 Subject: [PATCH 1/2] feat: Config home url --- .../src/DependencyInjection/MoonShineConfigurator.php | 10 ++++++++++ src/Laravel/src/MoonShineEndpoints.php | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/Laravel/src/DependencyInjection/MoonShineConfigurator.php b/src/Laravel/src/DependencyInjection/MoonShineConfigurator.php index 2cf481965..5a2ddb443 100644 --- a/src/Laravel/src/DependencyInjection/MoonShineConfigurator.php +++ b/src/Laravel/src/DependencyInjection/MoonShineConfigurator.php @@ -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; diff --git a/src/Laravel/src/MoonShineEndpoints.php b/src/Laravel/src/MoonShineEndpoints.php index a48e382e6..2b4cd7ba0 100644 --- a/src/Laravel/src/MoonShineEndpoints.php +++ b/src/Laravel/src/MoonShineEndpoints.php @@ -147,6 +147,10 @@ public function toPage( public function home(): string { + if($url = moonshineConfig()->getHomeUrl()) { + return $url; + } + return route( moonshineConfig()->getHomeRoute() ); From 234dd5c44b712a7245bf2e16857949678b106dd2 Mon Sep 17 00:00:00 2001 From: lee-to Date: Sun, 5 Jan 2025 12:55:15 +0000 Subject: [PATCH 2/2] Fix styling --- src/Laravel/src/MoonShineEndpoints.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Laravel/src/MoonShineEndpoints.php b/src/Laravel/src/MoonShineEndpoints.php index 2b4cd7ba0..7d804fc78 100644 --- a/src/Laravel/src/MoonShineEndpoints.php +++ b/src/Laravel/src/MoonShineEndpoints.php @@ -147,7 +147,7 @@ public function toPage( public function home(): string { - if($url = moonshineConfig()->getHomeUrl()) { + if ($url = moonshineConfig()->getHomeUrl()) { return $url; }