request get api in laravel controller 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
}