ResponseFactory
class ResponseFactory implements ResponseFactory (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected Factory | $view | The view factory instance. |
|
protected Redirector | $redirector | The redirector instance. |
Methods
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Return a new response from the application.
Return a new view response from the application.
Return a new JSON response from the application.
Return a new JSONP response from the application.
Create a new file download response.
Create a new redirect response to the given path.
Create a new redirect response to a named route.
Create a new redirect response to a controller action.
Create a new redirect response, while putting the current URL in the session.
Create a new redirect response to the previously intended location.
Details
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
void
__construct(Factory $view, Redirector $redirector)
Create a new response factory instance.
Response
make(string $content = '', int $status = 200, array $headers = [])
Return a new response from the application.
Response
view(string $view, array $data = [], int $status = 200, array $headers = [])
Return a new view response from the application.
JsonResponse
json(string|array $data = [], int $status = 200, array $headers = [], int $options = 0)
Return a new JSON response from the application.
JsonResponse
jsonp(string $callback, string|array $data = [], int $status = 200, array $headers = [], int $options = 0)
Return a new JSONP response from the application.
StreamedResponse
stream(Closure $callback, int $status = 200, array $headers = [])
Return a new streamed response from the application.
BinaryFileResponse
download(SplFileInfo|string $file, string $name = null, array $headers = [], string|null $disposition = 'attachment')
Create a new file download response.
BinaryFileResponse
file(SplFileInfo|string $file, array $headers = [])
Return the raw contents of a binary file.
RedirectResponse
redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Create a new redirect response to the given path.
RedirectResponse
redirectToRoute(string $route, array $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a named route.
RedirectResponse
redirectToAction(string $action, array $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a controller action.
RedirectResponse
redirectGuest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Create a new redirect response, while putting the current URL in the session.
RedirectResponse
redirectToIntended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)
Create a new redirect response to the previously intended location.