ResponseFactory
interface ResponseFactory (View source)
Methods
Response | make(string $content = '', int $status = 200, array $headers = []) Create a new response instance. | |
Response | noContent(int $status = 204, array $headers = []) Create a new "no content" response. | |
Response | view(string|array $view, array $data = [], int $status = 200, array $headers = []) Create a new response for a given view. | |
JsonResponse | json(mixed $data = [], int $status = 200, array $headers = [], int $options = 0) Create a new JSON response instance. | |
JsonResponse | jsonp(string $callback, mixed $data = [], int $status = 200, array $headers = [], int $options = 0) Create a new JSONP response instance. | |
StreamedResponse | stream(Closure $callback, int $status = 200, array $headers = []) Create a new streamed response instance. | |
StreamedResponse | streamDownload(Closure $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment') Create a new streamed response instance as a file download. | |
BinaryFileResponse | download(SplFileInfo|string $file, string|null $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, mixed $parameters = [], int $status = 302, array $headers = []) Create a new redirect response to a named route. | |
RedirectResponse | redirectToAction(string $action, mixed $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. |
Details
Response make(string $content = '', int $status = 200, array $headers = [])
Create a new response instance.
Response noContent(int $status = 204, array $headers = [])
Create a new "no content" response.
Response view(string|array $view, array $data = [], int $status = 200, array $headers = [])
Create a new response for a given view.
JsonResponse json(mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
Create a new JSON response instance.
JsonResponse jsonp(string $callback, mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
Create a new JSONP response instance.
StreamedResponse stream(Closure $callback, int $status = 200, array $headers = [])
Create a new streamed response instance.
StreamedResponse streamDownload(Closure $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
Create a new streamed response instance as a file download.
BinaryFileResponse download(SplFileInfo|string $file, string|null $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, mixed $parameters = [], int $status = 302, array $headers = [])
Create a new redirect response to a named route.
RedirectResponse redirectToAction(string $action, mixed $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.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Contracts/Routing/ResponseFactory.html