Laravel Check If Api Request Code Example

Laravel 8 , Laravel 7 , Laravel , Laravel 6

Nicesnippets

1427

22-01-2021


Hi Guys,

In this blog,I will learn you how to check api request in laravel.you can easy amd simply check to api request in laravel.

Since many applications only serve HTML or JSON, you may use the expectsJson method to quickly determine if the incoming request expects a JSON response:

if (Request::wantsJson()) {

// return JSON-formatted response

} else {

// return HTML response

}

It will help you....


Recommended Posts