Level 104
$request->wantsJson() will inform you if the request has application/json header.
Summer Sale! All accounts are 50% off this week.
I have a project which has API users and Session users
I use FormRequest objects fro validation and these automatically detect if the request is a session or API request and return JSON for api requests and redirects for Session requests
Is there any way i can make this distinction in my controllers?
I have a controller which can serve both API and Session users - one needs a JSON response the other needs a redirect
$request->wantsJson() will inform you if the request has application/json header.
Please or to participate in this conversation.