Redirector
class Redirector
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected UrlGenerator | $generator | The URL generator instance. |
|
| protected Store | $session | The session store instance. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new redirect response to the previous location.
Create a new redirect response to the current URI.
Create a new redirect response, while putting the current URL in the session.
Create a new redirect response to the previously intended location.
Create a new redirect response to the given path.
Create a new redirect response to an external URL (no validation).
Create a new redirect response to the given HTTPS path.
Create a new redirect response to a named route.
Create a new redirect response to a signed named route.
Create a new redirect response to a temporary signed named route.
Create a new redirect response to a controller action.
Create a new redirect response.
Get the URL generator instance.
Get the "intended" URL from the session.
Set the "intended" URL in the session.
Flush all static state.
Details
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 31
__construct(UrlGenerator $generator)
Create a new Redirector instance.
at line 39
RedirectResponse
back(int $status = 302, array $headers = [], bool|string $fallback = false)
Create a new redirect response to the previous location.
at line 47
RedirectResponse
refresh(int $status = 302, array $headers = [])
Create a new redirect response to the current URI.
at line 55
RedirectResponse
guest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Create a new redirect response, while putting the current URL in the session.
at line 73
RedirectResponse
intended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)
Create a new redirect response to the previously intended location.
at line 83
RedirectResponse
to(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Create a new redirect response to the given path.
at line 91
RedirectResponse
away(string $path, int $status = 302, array $headers = [])
Create a new redirect response to an external URL (no validation).
at line 99
RedirectResponse
secure(string $path, int $status = 302, array $headers = [])
Create a new redirect response to the given HTTPS path.
at line 107
RedirectResponse
route(BackedEnum|string $route, array|string $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a named route.
at line 115
RedirectResponse
signedRoute(BackedEnum|string $route, array|string $parameters = [], DateInterval|DateTimeInterface|int|null $expiration = null, int $status = 302, array $headers = [])
Create a new redirect response to a signed named route.
at line 123
RedirectResponse
temporarySignedRoute(BackedEnum|string $route, DateInterval|DateTimeInterface|int $expiration, array $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a temporary signed named route.
at line 131
RedirectResponse
action(array|string $action, array|string $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a controller action.
at line 139
protected RedirectResponse
createRedirect(string $path, int $status, array $headers)
Create a new redirect response.
at line 153
UrlGenerator
getUrlGenerator()
Get the URL generator instance.
at line 161
void
setSession(Store $session)
Set the active session store.
at line 169
string|null
getIntendedUrl()
Get the "intended" URL from the session.
at line 179
Redirector
setIntendedUrl(string $url)
Set the "intended" URL in the session.
at line 189
static void
flushState()
Flush all static state.