trait
Illuminate
/
Http
/
Concerns
/
InteractsWithContentTypes
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.
InteractsWithContentTypes
Methods
public
isJson ( ) : bool
Determine if the request is sending JSON.
public
expectsJson ( ) : bool
Determine if the current request probably expects a JSON response.
public
wantsJson ( ) : bool
Determine if the current request is asking for JSON.
public
accepts ( $contentTypes ) : bool
Determines whether the current requests accepts a given content type.
Parameters
- $contentTypes string|array
public
prefers ( $contentTypes ) : string|null
Return the most suitable content type from the given array based on content negotiation.
Parameters
- $contentTypes string|array
public
acceptsAnyContentType ( ) : bool
Determine if the current request accepts any content type.
public
acceptsJson ( ) : bool
Determines whether a request accepts JSON.
public
acceptsHtml ( ) : bool
Determines whether a request accepts HTML.
public
static
matchesType ( $actual , $type ) : bool
Determine if the given content types match.
Parameters
- $actual string
- $type string
public
format ( $default ) : string
Get the data format expected in the response.
Parameters
- $default string