#### How to throw NotFoundResourceException with code status code 404 in Laravel

I am trying to throw a NotFoundResourceException in Laravel programmatically

  use SymfonyComponentTranslationExceptionNotFoundResourceException;

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?

Source: Laravel