Laravel version: 5.5
I am trying to return custom http status code from the laravel controller. (Calling this url using jQuery Ajax $.get())
In my controller function I tried both the way mentioned bellow but it's not working.
This one returns error "Method setStatusCode does not exist."
return response()->setStatusCode(202);
This one not throwing error but returning 200 always.
$response = new Response(); $response->setStatusCode(202); $response->header('custom', 555); return $response;`
Use it like this:
Check https://laravel.com/api/5.0/Illuminate/Routing/ResponseFactory.html for more detailed documentation.