class FormRequest extends Request implements ValidatesWhenResolved (View source)
ValidatesWhenResolvedTrait | Provides default implementation of ValidatesWhenResolved contract. |
InteractsWithContentTypes | |
InteractsWithFlashData | |
InteractsWithInput | |
Macroable |
static protected array | $macros | The registered string macros. | from Macroable |
protected ParameterBag|null | $json | The decoded JSON content for the request. | from Request |
protected array | $convertedFiles | All of the converted files for the request. | from Request |
protected Closure | $userResolver | The user resolver callback. | from Request |
protected Closure | $routeResolver | The route resolver callback. | from Request |
protected Container | $container | The container instance. | |
protected Redirector | $redirector | The redirector instance. | |
protected string | $redirect | The URI to redirect to if validation fails. | |
protected string | $redirectRoute | The route to redirect to if validation fails. | |
protected string | $redirectAction | The controller action to redirect to if validation fails. | |
protected string | $errorBag | The key to be used for the view error bag. | |
protected Validator | $validator | The validator instance. |
static bool | matchesType(string $actual, string $type) Determine if the given content types match. | from InteractsWithContentTypes |
bool | isJson() Determine if the request is sending JSON. | from InteractsWithContentTypes |
bool | expectsJson() Determine if the current request probably expects a JSON response. | from InteractsWithContentTypes |
bool | wantsJson() Determine if the current request is asking for JSON. | from InteractsWithContentTypes |
bool | accepts(string|array $contentTypes) Determines whether the current requests accepts a given content type. | from InteractsWithContentTypes |
string|null | prefers(string|array $contentTypes) Return the most suitable content type from the given array based on content negotiation. | from InteractsWithContentTypes |
bool | acceptsAnyContentType() Determine if the current request accepts any content type. | from InteractsWithContentTypes |
bool | acceptsJson() Determines whether a request accepts JSON. | from InteractsWithContentTypes |
bool | acceptsHtml() Determines whether a request accepts HTML. | from InteractsWithContentTypes |
string | format(string $default = 'html') Get the data format expected in the response. | from InteractsWithContentTypes |
string|array | old(string|null $key = null, string|array|null $default = null) Retrieve an old input item. | from InteractsWithFlashData |
void | flash() Flash the input for the current request to the session. | from InteractsWithFlashData |
void | flashOnly(array|mixed $keys) Flash only some of the input to the session. | from InteractsWithFlashData |
void | flashExcept(array|mixed $keys) Flash only some of the input to the session. | from InteractsWithFlashData |
void | flush() Flush all of the old input from the session. | from InteractsWithFlashData |
string|array|null | server(string|null $key = null, string|array|null $default = null) Retrieve a server variable from the request. | from InteractsWithInput |
bool | hasHeader(string $key) Determine if a header is set on the request. | from InteractsWithInput |
string|array|null | header(string|null $key = null, string|array|null $default = null) Retrieve a header from the request. | from InteractsWithInput |
string|null | bearerToken() Get the bearer token from the request headers. | from InteractsWithInput |
bool | exists(string|array $key) Determine if the request contains a given input item key. | from InteractsWithInput |
bool | has(string|array $key) Determine if the request contains a given input item key. | from InteractsWithInput |
bool | hasAny(string|array $keys) Determine if the request contains any of the given inputs. | from InteractsWithInput |
$this|mixed | whenHas(string $key, callable $callback) Apply the callback if the request contains the given input item key. | from InteractsWithInput |
bool | filled(string|array $key) Determine if the request contains a non-empty value for an input item. | from InteractsWithInput |
bool | isNotFilled(string|array $key) Determine if the request contains an empty value for an input item. | from InteractsWithInput |
bool | anyFilled(string|array $keys) Determine if the request contains a non-empty value for any of the given inputs. | from InteractsWithInput |
$this|mixed | whenFilled(string $key, callable $callback) Apply the callback if the request contains a non-empty value for the given input item key. | from InteractsWithInput |
bool | missing(string|array $key) Determine if the request is missing a given input item key. | from InteractsWithInput |
bool | isEmptyString(string $key) Determine if the given input key is an empty string for "has". | from InteractsWithInput |
array | keys() Get the keys for all of the input and files. | from InteractsWithInput |
array | all(array|mixed|null $keys = null) Get all of the input and files for the request. | from InteractsWithInput |
mixed | input(string|null $key = null, mixed $default = null) Retrieve an input item from the request. | from InteractsWithInput |
bool | boolean(string|null $key = null, bool $default = false) Retrieve input as a boolean value. | from InteractsWithInput |
array | only(array|mixed $keys) Get a subset containing the provided keys with values from the input data. | from InteractsWithInput |
array | except(array|mixed $keys) Get all of the input except for a specified array of items. | from InteractsWithInput |
string|array|null | query(string|null $key = null, string|array|null $default = null) Retrieve a query string item from the request. | from InteractsWithInput |
string|array|null | post(string|null $key = null, string|array|null $default = null) Retrieve a request payload item from the request. | from InteractsWithInput |
bool | hasCookie(string $key) Determine if a cookie is set on the request. | from InteractsWithInput |
string|array|null | cookie(string|null $key = null, string|array|null $default = null) Retrieve a cookie from the request. | from InteractsWithInput |
array | allFiles() Get an array of all of the files on the request. | from InteractsWithInput |
array | convertUploadedFiles(array $files) Convert the given array of Symfony UploadedFiles to custom Laravel UploadedFiles. | from InteractsWithInput |
bool | hasFile(string $key) Determine if the uploaded data contains a file. | from InteractsWithInput |
bool | isValidFile(mixed $file) Check that the given file is a valid file instance. | from InteractsWithInput |
UploadedFile|UploadedFile[]|array|null | file(string|null $key = null, mixed $default = null) Retrieve a file from the request. | from InteractsWithInput |
string|array|null | retrieveItem(string $source, string $key, string|array|null $default) Retrieve a parameter item from a given source. | from InteractsWithInput |
static void | macro(string $name, object|callable $macro) Register a custom macro. | from Macroable |
static void | mixin(object $mixin, bool $replace = true) Mix another object into the class. | from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. | from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
static Request | capture() Create a new Illuminate HTTP request from server variables. | from Request |
$this | instance() Return the Request instance. | from Request |
string | method() Get the request method. | from Request |
string | root() Get the root URL for the application. | from Request |
string | url() Get the URL (no query string) for the request. | from Request |
string | fullUrl() Get the full URL for the request. | from Request |
string | fullUrlWithQuery(array $query) Get the full URL for the request with the added query string parameters. | from Request |
string | path() Get the current path info for the request. | from Request |
string | decodedPath() Get the current decoded path info for the request. | from Request |
string|null | segment(int $index, string|null $default = null) Get a segment from the URI (1 based index). | from Request |
array | segments() Get all of the segments for the request path. | from Request |
bool | is(mixed ...$patterns) Determine if the current request URI matches a pattern. | from Request |
bool | routeIs(mixed ...$patterns) Determine if the route name matches a given pattern. | from Request |
bool | fullUrlIs(mixed ...$patterns) Determine if the current request URL and query string matches a pattern. | from Request |
bool | ajax() Determine if the request is the result of an AJAX call. | from Request |
bool | pjax() Determine if the request is the result of an PJAX call. | from Request |
bool | prefetch() Determine if the request is the result of an prefetch call. | from Request |
bool | secure() Determine if the request is over HTTPS. | from Request |
string|null | ip() Get the client IP address. | from Request |
array | ips() Get the client IP addresses. | from Request |
string|null | userAgent() Get the client user agent. | from Request |
$this | merge(array $input) Merge new input into the current request's input array. | from Request |
$this | replace(array $input) Replace the input for the current request. | from Request |
mixed | get(string $key, mixed $default = null) This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel. | from Request |
ParameterBag|mixed | json(string|null $key = null, mixed $default = null) Get the JSON payload for the request. | from Request |
ParameterBag | getInputSource() Get the input source for the request. | from Request |
static Request | createFrom(Request $from, Request|null $to = null) Create a new request instance from the given Laravel request. | from Request |
static Request | createFromBase(Request $request) Create an Illuminate request from a Symfony instance. | from Request |
duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) {@inheritdoc} | from Request | |
mixed | filterFiles(mixed $files) Filter the given array of files, removing any empty values. | from Request |
Store | session() Get the session associated with the request. | from Request |
Store|null | getSession() Get the session associated with the request. | from Request |
void | setLaravelSession(Session $session) Set the session instance on the request. | from Request |
mixed | user(string|null $guard = null) Get the user making the request. | from Request |
Route|object|string|null | route(string|null $param = null, mixed $default = null) Get the route handling the request. | from Request |
string | fingerprint() Get a unique fingerprint for the request / route / IP address. | from Request |
$this | setJson(ParameterBag $json) Set the JSON payload for the request. | from Request |
Closure | getUserResolver() Get the user resolver callback. | from Request |
$this | setUserResolver(Closure $callback) Set the user resolver callback. | from Request |
Closure | getRouteResolver() Get the route resolver callback. | from Request |
$this | setRouteResolver(Closure $callback) Set the route resolver callback. | from Request |
array | toArray() Get all of the input and files for the request. | from Request |
bool | offsetExists(string $offset) Determine if the given offset exists. | from Request |
mixed | offsetGet(string $offset) Get the value at the given offset. | from Request |
void | offsetSet(string $offset, mixed $value) Set the value at the given offset. | from Request |
void | offsetUnset(string $offset) Remove the value at the given offset. | from Request |
bool | __isset(string $key) Check if an input element is set on the request. | from Request |
mixed | __get(string $key) Get an input element from the request. | from Request |
array | validate(array $rules, mixed $params) No description | from Request |
array | validateWithBag(string $errorBag, array $rules, mixed $params) No description | from Request |
bool | hasValidSignature(bool $absolute = true) No description | from Request |
void | validateResolved() Validate the class instance. | from ValidatesWhenResolvedTrait |
void | prepareForValidation() Prepare the data for validation. | from ValidatesWhenResolvedTrait |
Validator | getValidatorInstance() Get the validator instance for the request. | |
void | passedValidation() Handle a passed validation attempt. | from ValidatesWhenResolvedTrait |
void | failedValidation(Validator $validator) Handle a failed validation attempt. | |
bool | passesAuthorization() Determine if the request passes the authorization check. | |
void | failedAuthorization() Handle a failed authorization attempt. | |
Validator | createDefaultValidator(Factory $factory) Create the default validator instance. | |
array | validationData() Get data to be validated from the request. | |
string | getRedirectUrl() Get the URL to redirect to on a validation error. | |
array | validated() Get the validated data from the request. | |
array | messages() Get custom messages for validator errors. | |
array | attributes() Get custom attributes for validator errors. | |
$this | setValidator(Validator $validator) Set the Validator instance. | |
$this | setRedirector(Redirector $redirector) Set the Redirector instance. | |
$this | setContainer(Container $container) Set the container implementation. |
Determine if the given content types match.
Determine if the request is sending JSON.
Determine if the current request probably expects a JSON response.
Determine if the current request is asking for JSON.
Determines whether the current requests accepts a given content type.
Return the most suitable content type from the given array based on content negotiation.
Determine if the current request accepts any content type.
Determines whether a request accepts JSON.
Determines whether a request accepts HTML.
Get the data format expected in the response.
Retrieve an old input item.
Flash the input for the current request to the session.
Flash only some of the input to the session.
Flash only some of the input to the session.
Flush all of the old input from the session.
Retrieve a server variable from the request.
Determine if a header is set on the request.
Retrieve a header from the request.
Get the bearer token from the request headers.
Determine if the request contains a given input item key.
Determine if the request contains a given input item key.
Determine if the request contains any of the given inputs.
Apply the callback if the request contains the given input item key.
Determine if the request contains a non-empty value for an input item.
Determine if the request contains an empty value for an input item.
Determine if the request contains a non-empty value for any of the given inputs.
Apply the callback if the request contains a non-empty value for the given input item key.
Determine if the request is missing a given input item key.
Determine if the given input key is an empty string for "has".
Get the keys for all of the input and files.
Get all of the input and files for the request.
Retrieve an input item from the request.
Retrieve input as a boolean value.
Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false.
Get a subset containing the provided keys with values from the input data.
Get all of the input except for a specified array of items.
Retrieve a query string item from the request.
Retrieve a request payload item from the request.
Determine if a cookie is set on the request.
Retrieve a cookie from the request.
Get an array of all of the files on the request.
Convert the given array of Symfony UploadedFiles to custom Laravel UploadedFiles.
Determine if the uploaded data contains a file.
Check that the given file is a valid file instance.
Retrieve a file from the request.
Retrieve a parameter item from a given source.
Register a custom macro.
Mix another object into the class.
Checks if macro is registered.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new Illuminate HTTP request from server variables.
Return the Request instance.
Get the request method.
Get the root URL for the application.
Get the URL (no query string) for the request.
Get the full URL for the request.
Get the full URL for the request with the added query string parameters.
Get the current path info for the request.
Get the current decoded path info for the request.
Get a segment from the URI (1 based index).
Get all of the segments for the request path.
Determine if the current request URI matches a pattern.
Determine if the route name matches a given pattern.
Determine if the current request URL and query string matches a pattern.
Determine if the request is the result of an AJAX call.
Determine if the request is the result of an PJAX call.
Determine if the request is the result of an prefetch call.
Determine if the request is over HTTPS.
Get the client IP address.
Get the client IP addresses.
Get the client user agent.
Merge new input into the current request's input array.
Replace the input for the current request.
This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel.
Instead, you may use the "input" method.
Get the JSON payload for the request.
Get the input source for the request.
Create a new request instance from the given Laravel request.
Create an Illuminate request from a Symfony instance.
{@inheritdoc}
Filter the given array of files, removing any empty values.
Get the session associated with the request.
Get the session associated with the request.
Set the session instance on the request.
Get the user making the request.
Get the route handling the request.
Get a unique fingerprint for the request / route / IP address.
Set the JSON payload for the request.
Get the user resolver callback.
Set the user resolver callback.
Get the route resolver callback.
Set the route resolver callback.
Get all of the input and files for the request.
Determine if the given offset exists.
Get the value at the given offset.
Set the value at the given offset.
Remove the value at the given offset.
Check if an input element is set on the request.
Get an input element from the request.
Validate the class instance.
Prepare the data for validation.
Get the validator instance for the request.
Handle a passed validation attempt.
Handle a failed validation attempt.
Determine if the request passes the authorization check.
Handle a failed authorization attempt.
Get data to be validated from the request.
Get the URL to redirect to on a validation error.
Get the validated data from the request.
Get custom messages for validator errors.
Get custom attributes for validator errors.
Set the Validator instance.
Set the Redirector instance.
Set the container implementation.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Foundation/Http/FormRequest.html