Skip to content

Commit

Permalink
updated getUrl() to accommodate all url patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
sammyskills committed Jan 6, 2023
1 parent dace47b commit 57b3295
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Config/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,21 @@ public function registerRedirect(): string

protected function getUrl(string $url): string
{
return strpos($url, 'http') === 0
? $url
: rtrim(site_url($url), '/ ');
// To accommodate all url patterns
$final_url = "";
switch ($url) {
case strpos($url, 'http') === 0: // URL begins with 'http'. E.g. http://example.com
$final_url = $url;
break;

case route_to($url) != null: // URL is a named-route
$final_url = route_to($url);
break;

default: // URL is a route (URI path)
$final_url = rtrim(site_url($url), '/ ');
break;
}
return $final_url;
}
}

0 comments on commit 57b3295

Please sign in to comment.