class Request extends Request implements ArrayAccess (View source)

Properties

protected string $json The decoded JSON content for the request.
protected Store $sessionStore The Illuminate session store implementation.
protected Closure $userResolver The user resolver callback.
protected Closure $routeResolver The route resolver callback.

Methods

static Request
capture()

Create a new Illuminate HTTP request from server variables.

$this
instance()

Return the Request instance.

string
method()

Get the request method.

string
root()

Get the root URL for the application.

string
url()

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

string
fullUrl()

Get the full URL for the request.

string
path()

Get the current path info for the request.

string
decodedPath()

Get the current encoded path info for the request.

string
segment(int $index, mixed $default = null)

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

array
segments()

Get all of the segments for the request path.

bool
is()

Determine if the current request URI matches a pattern.

bool
ajax()

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

bool
pjax()

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

bool
secure()

Determine if the request is over HTTPS.

string
ip()

Returns the client IP address.

array
ips()

Returns the client IP addresses.

bool
exists(string|array $key)

Determine if the request contains a given input item key.

bool
has(string|array $key)

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

bool
isEmptyString(string $key)

Determine if the given input key is an empty string for "has".

array
all()

Get all of the input and files for the request.

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

Retrieve an input item from the request.

array
only(array $keys)

Get a subset of the items from the input data.

array
except(array $keys)

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

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

Retrieve a query string item from the request.

bool
hasCookie(string $key)

Determine if a cookie is set on the request.

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

Retrieve a cookie from the request.

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

Retrieve a file from the request.

bool
hasFile(string $key)

Determine if the uploaded data contains a file.

bool
isValidFile(mixed $file)

Check that the given file is a valid file instance.

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

Retrieve a header from the request.

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

Retrieve a server variable from the request.

mixed
old(string $key = null, mixed $default = null)

Retrieve an old input item.

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

Flash the input for the current request to the session.

void
flashOnly(mixed $keys)

Flash only some of the input to the session.

void
flashExcept(mixed $keys)

Flash only some of the input to the session.

void
flush()

Flush all of the old input from the session.

string|array
retrieveItem(string $source, string $key, mixed $default)

Retrieve a parameter item from a given source.

void
merge(array $input)

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

void
replace(array $input)

Replace the input for the current request.

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

Get the JSON payload for the request.

ParameterBag
getInputSource()

Get the input source for the request.

bool
isJson()

Determine if the request is sending JSON.

bool
wantsJson()

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

string
format(string $default = 'html')

Get the data format expected in the response.

static Request
createFromBase(Request $request)

Create an Illuminate request from a Symfony instance.

duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)

{@inheritdoc}

session()

Get the session associated with the request.

mixed
user()

Get the user making the request.

Route|null
route()

Get the route handling the request.

getUserResolver()

Get the user resolver callback.

$this
setUserResolver(Closure $callback)

Set the user resolver callback.

getRouteResolver()

Get the route resolver callback.

$this
setRouteResolver(Closure $callback)

Set the route resolver callback.

bool
offsetExists(string $offset)

Determine if the given offset exists.

mixed
offsetGet(string $offset)

Get the value at the given offset.

void
offsetSet(string $offset, mixed $value)

Set the value at the given offset.

void
offsetUnset(string $offset)

Remove the value at the given offset.

mixed
__get(string $key)

Get an input element from the request.

Details

static Request capture()

Create a new Illuminate HTTP request from server variables.

Return Value

Request

$this instance()

Return the Request instance.

Return Value

$this

string method()

Get the request method.

Return Value

string

string root()

Get the root URL for the application.

Return Value

string

string url()

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

Return Value

string

string fullUrl()

Get the full URL for the request.

Return Value

string

string path()

Get the current path info for the request.

Return Value

string

string decodedPath()

Get the current encoded path info for the request.

Return Value

string

string segment(int $index, mixed $default = null)

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

Parameters

int $index
mixed $default

Return Value

string

array segments()

Get all of the segments for the request path.

Return Value

array

bool is()

Determine if the current request URI matches a pattern.

Return Value

bool

bool ajax()

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

Return Value

bool

bool pjax()

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

Return Value

bool

bool secure()

Determine if the request is over HTTPS.

Return Value

bool

string ip()

Returns the client IP address.

Return Value

string

array ips()

Returns the client IP addresses.

Return Value

array

bool exists(string|array $key)

Determine if the request contains a given input item key.

Parameters

string|array $key

Return Value

bool

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

protected bool isEmptyString(string $key)

Determine if the given input key is an empty string for "has".

Parameters

string $key

Return Value

bool

array all()

Get all of the input and files for the request.

Return Value

array

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

Retrieve an input item from the request.

Parameters

string $key
mixed $default

Return Value

string|array

array only(array $keys)

Get a subset of the items from the input data.

Parameters

array $keys

Return Value

array

array except(array $keys)

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

Parameters

array $keys

Return Value

array

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

Retrieve a query string item from the request.

Parameters

string $key
mixed $default

Return Value

string|array

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
mixed $default

Return Value

string|array

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

Retrieve a file from the request.

Parameters

string $key
mixed $default

Return Value

UploadedFile|array

bool hasFile(string $key)

Determine if the uploaded data contains a file.

Parameters

string $key

Return Value

bool

protected bool isValidFile(mixed $file)

Check that the given file is a valid file instance.

Parameters

mixed $file

Return Value

bool

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

Retrieve a header from the request.

Parameters

string $key
mixed $default

Return Value

string|array

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

Retrieve a server variable from the request.

Parameters

string $key
mixed $default

Return Value

string|array

mixed old(string $key = null, mixed $default = null)

Retrieve an old input item.

Parameters

string $key
mixed $default

Return Value

mixed

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

void flashOnly(mixed $keys)

Flash only some of the input to the session.

Parameters

mixed $keys string

Return Value

void

void flashExcept(mixed $keys)

Flash only some of the input to the session.

Parameters

mixed $keys string

Return Value

void

void flush()

Flush all of the old input from the session.

Return Value

void

protected string|array retrieveItem(string $source, string $key, mixed $default)

Retrieve a parameter item from a given source.

Parameters

string $source
string $key
mixed $default

Return Value

string|array

void merge(array $input)

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

Parameters

array $input

Return Value

void

void replace(array $input)

Replace the input for the current request.

Parameters

array $input

Return Value

void

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

Get the JSON payload for the request.

Parameters

string $key
mixed $default

Return Value

mixed

protected ParameterBag getInputSource()

Get the input source for the request.

Return Value

ParameterBag

bool isJson()

Determine if the request is sending JSON.

Return Value

bool

bool wantsJson()

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

Return Value

bool

string format(string $default = 'html')

Get the data format expected in the response.

Parameters

string $default

Return Value

string

static Request createFromBase(Request $request)

Create an Illuminate request from a Symfony instance.

Parameters

Request $request

Return Value

Request

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

Store session()

Get the session associated with the request.

Return Value

Store

Exceptions

RuntimeException

mixed user()

Get the user making the request.

Return Value

mixed

Route|null route()

Get the route handling the request.

Return Value

Route|null

Closure getUserResolver()

Get the user resolver callback.

Return Value

Closure

$this setUserResolver(Closure $callback)

Set the user resolver callback.

Parameters

Closure $callback

Return Value

$this

Closure getRouteResolver()

Get the route resolver callback.

Return Value

Closure

$this setRouteResolver(Closure $callback)

Set the route resolver callback.

Parameters

Closure $callback

Return Value

$this

bool offsetExists(string $offset)

Determine if the given offset exists.

Parameters

string $offset

Return Value

bool

mixed offsetGet(string $offset)

Get the value at the given offset.

Parameters

string $offset

Return Value

mixed

void offsetSet(string $offset, mixed $value)

Set the value at the given offset.

Parameters

string $offset
mixed $value

Return Value

void

void offsetUnset(string $offset)

Remove the value at the given offset.

Parameters

string $offset

Return Value

void

mixed __get(string $key)

Get an input element from the request.

Parameters

string $key

Return Value

mixed