laravel check if request wantsjson
snippet in php

laravel check if request wantsjson

user2357

extends the Symfony\Component\HttpFoundation\Request 

Determine If The Request Is Asking For JSON
if (Request::wantsJson())
{
    //
}