From c24adaa47d49160462af0e369f14aa964847c781 Mon Sep 17 00:00:00 2001 From: Titus Kirch Date: Sun, 29 Oct 2023 13:19:27 +0100 Subject: [PATCH] Add public url --- .env.example | 1 + app/Models/Person.php | 8 +++++++- config/app.php | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index e2ec3a2..d3b15b0 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,7 @@ APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=http://localhost +APP_PUBLIC_URL=http://localhost APP_IS_VPN=false APP_PORTALS_URL=http://127.0.0.1:8000 diff --git a/app/Models/Person.php b/app/Models/Person.php index 8988e54..1d62d23 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -117,9 +117,15 @@ public function createAuthLink() { $this->generateAuthToken(); - return route('person.authWithToken', [ + // generate the route + $personAuthWithTokenRoute = route('person.authWithToken', [ 'id' => $this->id, 'token' => $this->auth_token ]); + + // get only the path + $personAuthWithTokenRoute = parse_url($personAuthWithTokenRoute, PHP_URL_PATH); + + return config('app.public_url') . $personAuthWithTokenRoute; } } diff --git a/config/app.php b/config/app.php index 6eb92f1..909b437 100644 --- a/config/app.php +++ b/config/app.php @@ -54,6 +54,8 @@ 'url' => env('APP_URL', 'http://localhost'), + 'public_url' => env('APP_PUBLIC_URL', 'http://localhost'), + 'asset_url' => env('ASSET_URL', null), /*