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