ResponseFactory
класс ResponseFactory реализует ResponseFactory (View source)
Особенности
| Macroable |
Свойства
| статический защищенный массив | $macros | Зарегистрированные строковые макросы. | из Macroable |
| защищенный Factory | $view | Экземпляр фабрики представлений. | |
| защищенный Redirector | $redirector | Экземпляр перенаправлений. |
Методы
| static void | macro(string $name, object|callable $macro)
Зарегистрировать пользовательское макрос. | из Macroable |
| static void | mixin(object $mixin, bool $replace = true)
Смешать другой объект в класс. | из Macroable |
| static bool | hasMacro(string $name)
Проверить, зарегистрировано ли макрос. | из Macroable |
| static void | flushMacros()
Очистить существующие макросы. | из Macroable |
| static mixed | __callStatic(string $method, array $parameters)
Динамически обработать вызовы класса. | из Macroable |
| mixed | __call(string $method, array $parameters)
Динамически обработать вызовы класса. | из Macroable |
| void | __construct(Factory $view, Redirector $redirector)
Создать новый экземпляр фабрики ответов. | |
| Response | make(array|string $content = '', int $status = 200, array $headers = [])
Создать новый экземпляр ответа. | |
| Response | noContent(int $status = 204, array $headers = [])
Создать новый ответ "без содержимого". | |
| Response | view(string|array $view, array $data = [], int $status = 200, array $headers = [])
Создать новый ответ для заданного представления. | |
| JsonResponse | json(mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
Создать новый экземпляр JSON ответа. | |
| JsonResponse | jsonp(string $callback, mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
Создать новый экземпляр JSONP ответа. | |
| StreamedResponse | stream(callable $callback, int $status = 200, array $headers = [])
Создать новый экземпляр ответа потокового типа. | |
| StreamedJsonResponse | streamJson(array $data, int $status = 200, array $headers = [], int $encodingOptions = JsonResponse::DEFAULT_ENCODING_OPTIONS)
Создать новый экземпляр ответа потокового типа. | |
| StreamedResponse | streamDownload(callable $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
Создать новый экземпляр ответа потокового типа для загрузки файла. | |
| BinaryFileResponse | download(SplFileInfo|string $file, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
Создать новый ответ для загрузки файла. | |
| string | fallbackName(string $name)
Преобразовать строку в ASCII символы, эквивалентные данному имени. | |
| BinaryFileResponse | file(SplFileInfo|string $file, array $headers = [])
Вернуть исходное содержимое бинарного файла. | |
| RedirectResponse | redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Создать новый ответ перенаправления на заданный путь. | |
| RedirectResponse | redirectToRoute(string $route, mixed $parameters = [], int $status = 302, array $headers = [])
Создать новый ответ перенаправления на заданный маршрут. | |
| RedirectResponse | redirectToAction(array|string $action, mixed $parameters = [], int $status = 302, array $headers = [])
Создать новый ответ перенаправления на действие контроллера. | |
| RedirectResponse | redirectGuest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Создать новый ответ перенаправления, сохраняя текущий URL в сессии. | |
| RedirectResponse | redirectToIntended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)
Создать новый ответ перенаправления на ранее заданный путь. |
Подробности
static void macro(string $name, object|callable $macro)
Зарегистрировать пользовательское макрос.
static void mixin(object $mixin, bool $replace = true)
Смешать другой объект в класс.
static bool hasMacro(string $name)
Проверить, зарегистрировано ли макрос.
static void flushMacros()
Очистить существующие макросы.
static mixed __callStatic(string $method, array $parameters)
Динамически обрабатывает вызовы к классу.
mixed __call(string $method, array $parameters)
Динамически обрабатывает вызовы к классу.
void __construct(Factory $view, Redirector $redirector)
Создать новый экземпляр фабрики ответов.
Response make(array|string $content = '', int $status = 200, array $headers = [])
Создать новый экземпляр ответа.
Response noContent(int $status = 204, array $headers = [])
Создать ответ "нет содержимого".
Response view(string|array $view, array $data = [], int $status = 200, array $headers = [])
Создать новый ответ для заданного представления.
JsonResponse json(mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
Создать новый JSON-ответ.
JsonResponse jsonp(string $callback, mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
Создать новый JSONP-ответ.
StreamedResponse stream(callable $callback, int $status = 200, array $headers = [])
Создать новый ответ потокового типа.
StreamedJsonResponse streamJson(array $data, int $status = 200, array $headers = [], int $encodingOptions = JsonResponse::DEFAULT_ENCODING_OPTIONS)
Создать новый ответ потокового типа.
StreamedResponse streamDownload(callable $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
Создать новый ответ для потокового скачивания файла.
BinaryFileResponse download(SplFileInfo|string $file, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
Создать новый ответ для скачивания файла.
protected string fallbackName(string $name)
Преобразует строку в ASCII-символы, эквивалентные заданному имени.
BinaryFileResponse file(SplFileInfo|string $file, array $headers = [])
Возвращает исходное содержимое двоичного файла.
RedirectResponse redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Создать новый ответ перенаправления на указанный путь.
RedirectResponse redirectToRoute(string $route, mixed $parameters = [], int $status = 302, array $headers = [])
Создать новый ответ перенаправления на указанный маршрут.
RedirectResponse redirectToAction(array|string $action, mixed $parameters = [], int $status = 302, array $headers = [])
Создать новый ответ перенаправления на действие контроллера.
RedirectResponse redirectGuest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
Создать новый ответ перенаправления, сохранив текущий URL в сессии.
RedirectResponse redirectToIntended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)
Создать новый ответ перенаправления на ранее заданный путь.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Routing/ResponseFactory.html