class FormRequest extends Request implements ValidatesWhenResolved (View source)

Traits

Provides default implementation of ValidatesWhenResolved contract.

Methods

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

Register a custom macro.

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 encoded 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()

Determine if the current request URI matches a pattern.

from Request
bool
fullUrlIs()

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
secure()

Determine if the request is over HTTPS.

from Request
string
ip()

Returns the client IP address.

from Request
array
ips()

Returns the client IP addresses.

from Request
bool
exists( string|array $key)

Determine if the request contains a given input item key.

from Request
bool
has( string|array $key)

Determine if the request contains a non-empty value for an input item.

from Request
array
all()

Get all of the input and files for the request.

from Request
string|array
input( string $key = null, string|array|null $default = null)

Retrieve an input item from the request.

from Request
array
only( array|mixed $keys)

Get a subset of the items from the input data.

from Request
array
except( array|mixed $keys)

Get all of the input except for a specified array of items.

from Request
array
intersect( array|mixed $keys)

Intersect an array of items with the input data.

from Request
string|array
query( string $key = null, string|array|null $default = null)

Retrieve a query string item from the request.

from Request
bool
hasCookie( string $key)

Determine if a cookie is set on the request.

from Request
string|array
cookie( string $key = null, string|array|null $default = null)

Retrieve a cookie from the request.

from Request
array
allFiles()

Get an array of all of the files on the request.

from Request
UploadedFile|array|null
file( string $key = null, mixed $default = null)

Retrieve a file from the request.

from Request
bool
hasFile( string $key)

Determine if the uploaded data contains a file.

from Request
bool
hasHeader( string $key)

Determine if a header is set on the request.

from Request
string|array
header( string $key = null, string|array|null $default = null)

Retrieve a header from the request.

from Request
string|array
server( string $key = null, string|array|null $default = null)

Retrieve a server variable from the request.

from Request
string|array
old( string $key = null, string|array|null $default = null)

Retrieve an old input item.

from Request
void
flash( string $filter = null, array $keys = array())

Flash the input for the current request to the session.

from Request
void
flashOnly( array|mixed $keys)

Flash only some of the input to the session.

from Request
void
flashExcept( array|mixed $keys)

Flash only some of the input to the session.

from Request
void
flush()

Flush all of the old input from the session.

from Request
void
merge( array $input)

Merge new input into the current request's input array.

from Request
void
replace( array $input)

Replace the input for the current request.

from Request
mixed
json( string $key = null, mixed $default = null)

Get the JSON payload for the request.

from Request
static  bool
matchesType( string $actual, string $type)

Determine if the given content types match.

from Request
bool
isJson()

Determine if the request is sending JSON.

from Request
bool
wantsJson()

Determine if the current request is asking for JSON in return.

from Request
bool
accepts( string|array $contentTypes)

Determines whether the current requests accepts a given content type.

from Request
string|null
prefers( string|array $contentTypes)

Return the most suitable content type from the given array based on content negotiation.

from Request
bool
acceptsJson()

Determines whether a request accepts JSON.

from Request
bool
acceptsHtml()

Determines whether a request accepts HTML.

from Request
string
format( string $default = 'html')

Get the data format expected in the response.

from Request
string|null
bearerToken()

Get the bearer token from the request headers.

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
session()

Get the session associated with the request.

from Request
mixed
user( string|null $guard = null)

Get the user making the request.

from Request
Route|object|string
route( string|null $param = null)

Get the route handling the request.

from Request
string
fingerprint()

Get a unique fingerprint for the request / route / IP address.

from Request
getUserResolver()

Get the user resolver callback.

from Request
$this
setUserResolver( Closure $callback)

Set the user resolver callback.

from Request
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
void
validate()

Validate the class instance.

Response
response( array $errors)

Get the proper failed validation response for the request.

forbiddenResponse()

Get the response for a forbidden operation.

setRedirector( Redirector $redirector)

Set the Redirector instance.

$this
setContainer( Container $container)

Set the container implementation.

array
messages()

Set custom messages for validator errors.

array
attributes()

Set custom attributes for validator errors.

Details

in Macroable at line line 24
static void macro( string $name, callable $macro)

Register a custom macro.

Parameters

string $name
callable $macro

Return Value

void

in Macroable at line line 35
static bool hasMacro( string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line line 49
static mixed __callStatic( string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line line 71
mixed __call( string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Request at line line 53
static Request capture()

Create a new Illuminate HTTP request from server variables.

Return Value

Request

in Request at line line 65
$this instance()

Return the Request instance.

Return Value

$this

in Request at line line 75
string method()

Get the request method.

Return Value

string

in Request at line line 85
string root()

Get the root URL for the application.

Return Value

string

in Request at line line 95
string url()

Get the URL (no query string) for the request.

Return Value

string

in Request at line line 105
string fullUrl()

Get the full URL for the request.

Return Value

string

in Request at line line 120
string fullUrlWithQuery( array $query)

Get the full URL for the request with the added query string parameters.

Parameters

array $query

Return Value

string

in Request at line line 132
string path()

Get the current path info for the request.

Return Value

string

in Request at line line 144
string decodedPath()

Get the current encoded path info for the request.

Return Value

string

in Request at line line 156
string|null segment( int $index, string|null $default = null)

Get a segment from the URI (1 based index).

Parameters

int $index
string|null $default

Return Value

string|null

in Request at line line 166
array segments()

Get all of the segments for the request path.

Return Value

array

in Request at line line 181
bool is()

Determine if the current request URI matches a pattern.

Return Value

bool

in Request at line line 198
bool fullUrlIs()

Determine if the current request URL and query string matches a pattern.

Return Value

bool

in Request at line line 216
bool ajax()

Determine if the request is the result of an AJAX call.

Return Value

bool

in Request at line line 226
bool pjax()

Determine if the request is the result of an PJAX call.

Return Value

bool

in Request at line line 236
bool secure()

Determine if the request is over HTTPS.

Return Value

bool

in Request at line line 246
string ip()

Returns the client IP address.

Return Value

string

in Request at line line 256
array ips()

Returns the client IP addresses.

Return Value

array

in Request at line line 267
bool exists( string|array $key)

Determine if the request contains a given input item key.

Parameters

string|array $key

Return Value

bool

in Request at line line 288
bool has( string|array $key)

Determine if the request contains a non-empty value for an input item.

Parameters

string|array $key

Return Value

bool

in Request at line line 321
array all()

Get all of the input and files for the request.

Return Value

array

in Request at line line 333
string|array input( string $key = null, string|array|null $default = null)

Retrieve an input item from the request.

Parameters

string $key
string|array|null $default

Return Value

string|array

in Request at line line 346
array only( array|mixed $keys)

Get a subset of the items from the input data.

Parameters

array|mixed $keys

Return Value

array

in Request at line line 367
array except( array|mixed $keys)

Get all of the input except for a specified array of items.

Parameters

array|mixed $keys

Return Value

array

in Request at line line 384
array intersect( array|mixed $keys)

Intersect an array of items with the input data.

Parameters

array|mixed $keys

Return Value

array

in Request at line line 396
string|array query( string $key = null, string|array|null $default = null)

Retrieve a query string item from the request.

Parameters

string $key
string|array|null $default

Return Value

string|array

in Request at line line 407
bool hasCookie( string $key)

Determine if a cookie is set on the request.

Parameters

string $key

Return Value

bool

Retrieve a cookie from the request.

Parameters

string $key
string|array|null $default

Return Value

string|array

in Request at line line 429
array allFiles()

Get an array of all of the files on the request.

Return Value

array

in Request at line line 464
UploadedFile|array|null file( string $key = null, mixed $default = null)

Retrieve a file from the request.

Parameters

string $key
mixed $default

Return Value

UploadedFile|array|null

in Request at line line 475
bool hasFile( string $key)

Determine if the uploaded data contains a file.

Parameters

string $key

Return Value

bool

in Request at line line 507
bool hasHeader( string $key)

Determine if a header is set on the request.

Parameters

string $key

Return Value

bool

in Request at line line 519
string|array header( string $key = null, string|array|null $default = null)

Retrieve a header from the request.

Parameters

string $key
string|array|null $default

Return Value

string|array

in Request at line line 531
string|array server( string $key = null, string|array|null $default = null)

Retrieve a server variable from the request.

Parameters

string $key
string|array|null $default

Return Value

string|array

in Request at line line 543
string|array old( string $key = null, string|array|null $default = null)

Retrieve an old input item.

Parameters

string $key
string|array|null $default

Return Value

string|array

in Request at line line 555
void flash( string $filter = null, array $keys = array())

Flash the input for the current request to the session.

Parameters

string $filter
array $keys

Return Value

void

in Request at line line 568
void flashOnly( array|mixed $keys)

Flash only some of the input to the session.

Parameters

array|mixed $keys

Return Value

void

in Request at line line 581
void flashExcept( array|mixed $keys)

Flash only some of the input to the session.

Parameters

array|mixed $keys

Return Value

void

in Request at line line 593
void flush()

Flush all of the old input from the session.

Return Value

void

in Request at line line 621
void merge( array $input)

Merge new input into the current request's input array.

Parameters

array $input

Return Value

void

in Request at line line 632
void replace( array $input)

Replace the input for the current request.

Parameters

array $input

Return Value

void

in Request at line line 644
mixed json( string $key = null, mixed $default = null)

Get the JSON payload for the request.

Parameters

string $key
mixed $default

Return Value

mixed

in Request at line line 678
static bool matchesType( string $actual, string $type)

Determine if the given content types match.

Parameters

string $actual
string $type

Return Value

bool

in Request at line line 694
bool isJson()

Determine if the request is sending JSON.

Return Value

bool

in Request at line line 704
bool wantsJson()

Determine if the current request is asking for JSON in return.

Return Value

bool

in Request at line line 717
bool accepts( string|array $contentTypes)

Determines whether the current requests accepts a given content type.

Parameters

string|array $contentTypes

Return Value

bool

in Request at line line 748
string|null prefers( string|array $contentTypes)

Return the most suitable content type from the given array based on content negotiation.

Parameters

string|array $contentTypes

Return Value

string|null

in Request at line line 778
bool acceptsJson()

Determines whether a request accepts JSON.

Return Value

bool

in Request at line line 788
bool acceptsHtml()

Determines whether a request accepts HTML.

Return Value

bool

in Request at line line 799
string format( string $default = 'html')

Get the data format expected in the response.

Parameters

string $default

Return Value

string

in Request at line line 815
string|null bearerToken()

Get the bearer token from the request headers.

Return Value

string|null

in Request at line line 830
static Request createFromBase( Request $request)

Create an Illuminate request from a Symfony instance.

Parameters

Request $request

Return Value

Request

in Request at line line 855
duplicate( array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)

{@inheritdoc}

Parameters

array $query
array $request
array $attributes
array $cookies
array $files
array $server

in Request at line line 867
Store session()

Get the session associated with the request.

Return Value

Store

Exceptions

RuntimeException

in Request at line line 882
mixed user( string|null $guard = null)

Get the user making the request.

Parameters

string|null $guard

Return Value

mixed

in Request at line line 894
Route|object|string route( string|null $param = null)

Get the route handling the request.

Parameters

string|null $param

Return Value

Route|object|string

in Request at line line 912
string fingerprint()

Get a unique fingerprint for the request / route / IP address.

Return Value

string

Exceptions

RuntimeException

in Request at line line 931
Closure getUserResolver()

Get the user resolver callback.

Return Value

Closure

in Request at line line 944
$this setUserResolver( Closure $callback)

Set the user resolver callback.

Parameters

Closure $callback

Return Value

$this

in Request at line line 956
Closure getRouteResolver()

Get the route resolver callback.

Return Value

Closure

in Request at line line 969
$this setRouteResolver( Closure $callback)

Set the route resolver callback.

Parameters

Closure $callback

Return Value

$this

in Request at line line 981
array toArray()

Get all of the input and files for the request.

Return Value

array

in Request at line line 992
bool offsetExists( string $offset)

Determine if the given offset exists.

Parameters

string $offset

Return Value

bool

in Request at line line 1003
mixed offsetGet( string $offset)

Get the value at the given offset.

Parameters

string $offset

Return Value

mixed

in Request at line line 1015
void offsetSet( string $offset, mixed $value)

Set the value at the given offset.

Parameters

string $offset
mixed $value

Return Value

void

in Request at line line 1026
void offsetUnset( string $offset)

Remove the value at the given offset.

Parameters

string $offset

Return Value

void

in Request at line line 1037
bool __isset( string $key)

Check if an input element is set on the request.

Parameters

string $key

Return Value

bool

in Request at line line 1048
mixed __get( string $key)

Get an input element from the request.

Parameters

string $key

Return Value

mixed

void validate()

Validate the class instance.

Return Value

void

at line line 134
Response response( array $errors)

Get the proper failed validation response for the request.

Parameters

array $errors

Return Value

Response

at line line 150
Response forbiddenResponse()

Get the response for a forbidden operation.

Return Value

Response

at line line 192
FormRequest setRedirector( Redirector $redirector)

Set the Redirector instance.

Parameters

Redirector $redirector

Return Value

FormRequest

at line line 205
$this setContainer( Container $container)

Set the container implementation.

Parameters

Container $container

Return Value

$this

at line line 217
array messages()

Set custom messages for validator errors.

Return Value

array

at line line 227
array attributes()

Set custom attributes for validator errors.

Return Value

array