trait Illuminate / Http / Concerns / InteractsWithInput
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

InteractsWithInput

Methods

public

server ( $key , $default ) : string|array|null

Retrieve a server variable from the request.

Parameters

  • $key string|null
  • $default string|array|null
public

hasHeader ( $key ) : bool

Determine if a header is set on the request.

Parameters

  • $key string
public

Retrieve a header from the request.

Parameters

  • $key string|null
  • $default string|array|null
public

bearerToken ( ) : string|null

Get the bearer token from the request headers.

public

exists ( $key ) : bool

Determine if the request contains a given input item key.

Parameters

  • $key string|array
public

has ( $key ) : bool

Determine if the request contains a given input item key.

Parameters

  • $key string|array
public

hasAny ( $keys ) : bool

Determine if the request contains any of the given inputs.

Parameters

  • $keys string|array
public

whenHas ( $key , callable $callback , callable $default ) : $this|mixed

Apply the callback if the request contains the given input item key.

Parameters

  • $key string
  • $callback callable
  • $default callable|null
public

filled ( $key ) : bool

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

Parameters

  • $key string|array
public

isNotFilled ( $key ) : bool

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

Parameters

  • $key string|array
public

anyFilled ( $keys ) : bool

Determine if the request contains a non-empty value for any of the given inputs.

Parameters

  • $keys string|array
public

whenFilled ( $key , callable $callback , callable $default ) : $this|mixed

Apply the callback if the request contains a non-empty value for the given input item key.

Parameters

  • $key string
  • $callback callable
  • $default callable|null
public

missing ( $key ) : bool

Determine if the request is missing a given input item key.

Parameters

  • $key string|array
public

whenMissing ( $key , callable $callback , callable $default ) : $this|mixed

Apply the callback if the request is missing the given input item key.

Parameters

  • $key string
  • $callback callable
  • $default callable|null
protected

isEmptyString ( $key ) : bool

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

Parameters

  • $key string
public

keys ( ) : array

Get the keys for all of the input and files.

public

all ( $keys ) : array

Get all of the input and files for the request.

Parameters

  • $keys array|mixed|null
public

input ( $key , $default ) : mixed

Retrieve an input item from the request.

Parameters

  • $key string|null
  • $default mixed
public

str ( $key , $default ) : Stringable

Retrieve input from the request as a Stringable instance.

Parameters

  • $key string
  • $default mixed
public

string ( $key , $default ) : Stringable

Retrieve input from the request as a Stringable instance.

Parameters

  • $key string
  • $default mixed
public

boolean ( $key , $default ) : bool

Retrieve input as a boolean value.

Parameters

  • $key string|null
  • $default bool
public

integer ( $key , $default ) : int

Retrieve input as an integer value.

Parameters

  • $key string
  • $default int
public

float ( $key , $default ) : float

Retrieve input as a float value.

Parameters

  • $key string
  • $default float
public

date ( $key , $format , $tz ) : Carbon |null

Retrieve input from the request as a Carbon instance.

Parameters

  • $key string
  • $format string|null
  • $tz string|null
public

enum ( $key , $enumClass ) : TEnum|null

Retrieve input from the request as an enum.

Parameters

  • $key string
  • $enumClass class-string<\TEnum>
public

collect ( $key ) : Illuminate\...\Collection

Retrieve input from the request as a collection.

Parameters

  • $key array|string|null
public

only ( $keys ) : array

Get a subset containing the provided keys with values from the input data.

Parameters

  • $keys array|mixed
public

except ( $keys ) : array

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

Parameters

  • $keys array|mixed
public

query ( $key , $default ) : string|array|null

Retrieve a query string item from the request.

Parameters

  • $key string|null
  • $default string|array|null
public

post ( $key , $default ) : string|array|null

Retrieve a request payload item from the request.

Parameters

  • $key string|null
  • $default string|array|null
public

hasCookie ( $key ) : bool

Determine if a cookie is set on the request.

Parameters

  • $key string
public

Retrieve a cookie from the request.

Parameters

  • $key string|null
  • $default string|array|null
public

allFiles ( ) : array

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

protected

convertUploadedFiles ( array $files ) : array

Convert the given array of Symfony UploadedFiles to custom Laravel UploadedFiles.

Parameters

  • $files array
public

hasFile ( $key ) : bool

Determine if the uploaded data contains a file.

Parameters

  • $key string
protected

isValidFile ( $file ) : bool

Check that the given file is a valid file instance.

Parameters

  • $file mixed
public

file ( $key , $default ) : UploadedFile |Illuminate\...\UploadedFile[]|array|null

Retrieve a file from the request.

Parameters

  • $key string|null
  • $default mixed
protected

retrieveItem ( $source , $key , $default ) : string|array|null

Retrieve a parameter item from a given source.

Parameters

  • $source string
  • $key string|null
  • $default string|array|null
public

dump ( $keys ) : $this

Dump the items.

Parameters

  • $keys mixed