Spec-Zone.ru › Laravel 11

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)

Зарегистрировать пользовательское макрос.

Параметры

string $name
object|callable $macro

Возвращаемое значение

void

static void mixin(object $mixin, bool $replace = true)

Смешать другой объект в класс.

Параметры

object $mixin
bool $replace

Возвращаемое значение

void

Исключения

ReflectionException

static bool hasMacro(string $name)

Проверить, зарегистрировано ли макрос.

Параметры

string $name

Возвращаемое значение

bool

static void flushMacros()

Очистить существующие макросы.

Возвращаемое значение

void

static mixed __callStatic(string $method, array $parameters)

Динамически обрабатывает вызовы к классу.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Динамически обрабатывает вызовы к классу.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void __construct(Factory $view, Redirector $redirector)

Создать новый экземпляр фабрики ответов.

Parameters

Factory $view
Redirector $redirector

Return Value

void

Response make(array|string $content = '', int $status = 200, array $headers = [])

Создать новый экземпляр ответа.

Parameters

array|string $content
int $status
array $headers

Return Value

Response

Response noContent(int $status = 204, array $headers = [])

Создать ответ "нет содержимого".

Parameters

int $status
array $headers

Return Value

Response

Response view(string|array $view, array $data = [], int $status = 200, array $headers = [])

Создать новый ответ для заданного представления.

Parameters

string|array $view
array $data
int $status
array $headers

Return Value

Response

JsonResponse json(mixed $data = [], int $status = 200, array $headers = [], int $options = 0)

Создать новый JSON-ответ.

Parameters

mixed $data
int $status
array $headers
int $options

Return Value

JsonResponse

JsonResponse jsonp(string $callback, mixed $data = [], int $status = 200, array $headers = [], int $options = 0)

Создать новый JSONP-ответ.

Parameters

string $callback
mixed $data
int $status
array $headers
int $options

Return Value

JsonResponse

StreamedResponse stream(callable $callback, int $status = 200, array $headers = [])

Создать новый ответ потокового типа.

Parameters

callable $callback
int $status
array $headers

Return Value

StreamedResponse

StreamedJsonResponse streamJson(array $data, int $status = 200, array $headers = [], int $encodingOptions = JsonResponse::DEFAULT_ENCODING_OPTIONS)

Создать новый ответ потокового типа.

Parameters

array $data
int $status
array $headers
int $encodingOptions

Return Value

StreamedJsonResponse

StreamedResponse streamDownload(callable $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')

Создать новый ответ для потокового скачивания файла.

Parameters

callable $callback
string|null $name
array $headers
string|null $disposition

Return Value

StreamedResponse

Exceptions

StreamedResponseException

BinaryFileResponse download(SplFileInfo|string $file, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')

Создать новый ответ для скачивания файла.

Parameters

SplFileInfo|string $file
string|null $name
array $headers
string|null $disposition

Return Value

BinaryFileResponse

protected string fallbackName(string $name)

Преобразует строку в ASCII-символы, эквивалентные заданному имени.

Parameters

string $name

Return Value

string

BinaryFileResponse file(SplFileInfo|string $file, array $headers = [])

Возвращает исходное содержимое двоичного файла.

Parameters

SplFileInfo|string $file
array $headers

Return Value

BinaryFileResponse

RedirectResponse redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null)

Создать новый ответ перенаправления на указанный путь.

Параметры

string $path
int $status
array $headers
bool|null $secure

Возвращаемое значение

RedirectResponse

RedirectResponse redirectToRoute(string $route, mixed $parameters = [], int $status = 302, array $headers = [])

Создать новый ответ перенаправления на указанный маршрут.

Параметры

string $route
mixed $parameters
int $status
array $headers

Возвращаемое значение

RedirectResponse

RedirectResponse redirectToAction(array|string $action, mixed $parameters = [], int $status = 302, array $headers = [])

Создать новый ответ перенаправления на действие контроллера.

Параметры

array|string $action
mixed $parameters
int $status
array $headers

Возвращаемое значение

RedirectResponse

RedirectResponse redirectGuest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)

Создать новый ответ перенаправления, сохранив текущий URL в сессии.

Параметры

string $path
int $status
array $headers
bool|null $secure

Возвращаемое значение

RedirectResponse

RedirectResponse redirectToIntended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)

Создать новый ответ перенаправления на ранее заданный путь.

Параметры

string $default
int $status
array $headers
bool|null $secure

Возвращаемое значение

RedirectResponse

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Routing/ResponseFactory.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API