InteractsWithContentTypes
trait InteractsWithContentTypes (View source)
Methods
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.
Determine if the given content types match.
Get the data format expected in the response.
Details
bool
isJson()
Determine if the request is sending JSON.
bool
expectsJson()
Determine if the current request probably expects a JSON response.
bool
wantsJson()
Determine if the current request is asking for JSON.
bool
accepts(string|array $contentTypes)
Determines whether the current requests accepts a given content type.
string|null
prefers(string|array $contentTypes)
Return the most suitable content type from the given array based on content negotiation.
bool
acceptsAnyContentType()
Determine if the current request accepts any content type.
bool
acceptsJson()
Determines whether a request accepts JSON.
bool
acceptsHtml()
Determines whether a request accepts HTML.
static bool
matchesType(string $actual, string $type)
Determine if the given content types match.
string
format(string $default = 'html')
Get the data format expected in the response.