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 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 32
__construct(UrlGenerator $generator)
Create a new Redirector instance.
at line 40
RedirectResponse
back(int $status = 302, array $headers = [], bool|string $fallback = false)
Create a new redirect response to the previous location.
at line 48
RedirectResponse
refresh(int $status = 302, array $headers = [])
Create a new redirect response to the current URI.
at line 56
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 74
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 84
RedirectResponse
to(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Create a new redirect response to the given path.
at line 92
RedirectResponse
away(string $path, int $status = 302, array $headers = [])
Create a new redirect response to an external URL (no validation).
at line 100
RedirectResponse
secure(string $path, int $status = 302, array $headers = [])
Create a new redirect response to the given HTTPS path.
at line 108
RedirectResponse
route(BackedEnum|string $route, mixed $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a named route.
at line 116
RedirectResponse
signedRoute(BackedEnum|string $route, mixed $parameters = [], DateInterval|DateTimeInterface|int|null $expiration = null, int $status = 302, array $headers = [])
Create a new redirect response to a signed named route.
at line 124
RedirectResponse
temporarySignedRoute(BackedEnum|string $route, DateInterval|DateTimeInterface|int $expiration, mixed $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a temporary signed named route.
at line 132
RedirectResponse
action(array|string $action, mixed $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a controller action.
at line 140
protected RedirectResponse
createRedirect(string $path, int $status, array $headers)
Create a new redirect response.
at line 154
UrlGenerator
getUrlGenerator()
Get the URL generator instance.
at line 165
void
setSession(Store $session)
Set the active session store.
Mutates the worker-shared Redirector while concurrent coroutines may still hold or use the previous session store.
at line 174
string|null
getIntendedUrl()
Get the "intended" URL from the session.
at line 184
Redirector
setIntendedUrl(string $url)
Set the "intended" URL in the session.
at line 194
static void
flushState()
Flush all static state.