Spec-Zone.ru › Laravel 10

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)

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

Details

static void macro(string $name, object|callable $macro)

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

Parameters

string $name
object|callable $macro

Return Value

void

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

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

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

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

Parameters

string $name

Return Value

bool

static void flushMacros()

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

Return Value

void
END_OF_DOCUMENT_MARKER

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)

Создаёт новый ответ с потоковой передачей JSON данных.

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

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)

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

Parameters

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

Return Value

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)

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

Параметры

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/10.x/Illuminate/Routing/ResponseFactory.html

Spec-Zone.ru

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