validate api request laravel code example
Example: laravel check if api request
if (Request::wantsJson()) {
// return JSON-formatted response
} else {
// return HTML response
}
if (Request::wantsJson()) {
// return JSON-formatted response
} else {
// return HTML response
}