From 17bb23b5b8521ee64c8e0e775453212a67a5cbbf Mon Sep 17 00:00:00 2001 From: Scai <59282365+alexevladgabriel@users.noreply.github.com> Date: Mon, 6 Jan 2025 19:58:32 +0200 Subject: [PATCH] refactor: route redirect links --- app/Http/Middleware/RedirectIfAuthenticated.php | 3 ++- app/Models/Node.php | 2 +- app/Notifications/RemovedFromServer.php | 3 ++- app/Notifications/ServerInstalled.php | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index d3d3e8fe92..91d25ff850 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use App\Filament\App\Resources\ServerResource\Pages\ListServers; use Illuminate\Http\Request; use Illuminate\Auth\AuthManager; @@ -18,7 +19,7 @@ public function __construct(private AuthManager $authManager) {} public function handle(Request $request, \Closure $next, ?string $guard = null): mixed { if ($this->authManager->guard($guard)->check()) { - return redirect()->route('filament.app.resources...index'); + return redirect(ListServers::getUrl()); } return $next($request); diff --git a/app/Models/Node.php b/app/Models/Node.php index e1931edbab..61de2d3103 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -201,7 +201,7 @@ public function getConfiguration(): array ], ], 'allowed_mounts' => $this->mounts->pluck('source')->toArray(), - 'remote' => route('filament.app.resources...index'), + 'remote' => config('app.url'), ]; } diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index f514a2f8d1..c8a967d27b 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -3,6 +3,7 @@ namespace App\Notifications; use App\Events\Server\SubUserRemoved; +use App\Filament\App\Resources\ServerResource\Pages\ListServers; use App\Models\Server; use App\Models\User; use Illuminate\Bus\Queueable; @@ -52,6 +53,6 @@ public function toMail(): MailMessage ->greeting('Hello ' . $this->user->username . '.') ->line('You have been removed as a subuser for the following server.') ->line('Server Name: ' . $this->server->name) - ->action('Visit Panel', route('filament.app.resources...index')); + ->action('Visit Panel', ListServers::getUrl()); } } diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index 4cfb83f87d..5e22249058 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -7,6 +7,7 @@ use App\Models\Server; use Illuminate\Container\Container; use App\Events\Server\Installed; +use App\Filament\App\Resources\ServerResource\Pages\ListServers; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Notifications\Dispatcher; @@ -63,6 +64,6 @@ public function toMail(): MailMessage ->greeting('Hello ' . $this->user->username . '.') ->line('Your server has finished installing and is now ready for you to use.') ->line('Server Name: ' . $this->server->name) - ->action('Login and Begin Using', route('filament.app.resources...index')); + ->action('Login and Begin Using', ListServers::getUrl()); } }