InteractsWithContentTypes
trait InteractsWithContentTypes (View source)
Methods
static bool | matchesType(string $actual, string $type) Determine if the given content types match. | |
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. | |
string | format(string $default = 'html') Get the data format expected in the response. |
Details
static bool matchesType(string $actual, string $type)
Determine if the given content types match.
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.
string format(string $default = 'html')
Get the data format expected in the response.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Http/Concerns/InteractsWithContentTypes.html