InteractsWithContentTypes
trait InteractsWithContentTypes
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.
Determine if the current request is asking for Markdown.
Determine 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.
Determine whether a request accepts JSON.
Determine whether a request accepts Markdown.
Determine whether a request accepts HTML.
Determine if the given content types match.
Get the data format expected in the response.
Details
at line 14
bool
isJson()
Determine if the request is sending JSON.
at line 22
bool
expectsJson()
Determine if the current request probably expects a JSON response.
at line 30
bool
wantsJson()
Determine if the current request is asking for JSON.
at line 40
bool
wantsMarkdown()
Determine if the current request is asking for Markdown.
at line 50
bool
accepts(string|array $contentTypes)
Determine whether the current requests accepts a given content type.
at line 86
string|null
prefers(string|array $contentTypes)
Return the most suitable content type from the given array based on content negotiation.
at line 124
bool
acceptsAnyContentType()
Determine if the current request accepts any content type.
at line 136
bool
acceptsJson()
Determine whether a request accepts JSON.
at line 144
bool
acceptsMarkdown()
Determine whether a request accepts Markdown.
at line 152
bool
acceptsHtml()
Determine whether a request accepts HTML.
at line 160
static bool
matchesType(string $actual, string $type)
Determine if the given content types match.
at line 174
string
format(string $default = 'html')
Get the data format expected in the response.