I am trying to throw a NotFoundResourceException
in Laravel programmatically
use Symfony\Component\Translation\Exception\NotFoundResourceException;
throw new NotFoundResourceException('The Item you could not be found', 404);
From the code editor I can see the hint that the second parameter is the code but this returns status 500 instead of 404
throw new NotFoundResourceException('The Item you could not be found');
without the parameter also returns status 500
I can use abort(404)
as suggested in How to make Laravel 5 return 404 status code but is there a way to throw
404 error?