How can I return a 404 Not Found error from my product controller?
kristiwr opened this issue · comments
kristiwr commented
Hello, I'm trying to figure out the best way to return a 404 error from my product controller. This would happen when the product route matches but there is no product post matching the slug. I've looked through the documentation and some of the Lumberjack source code and haven't found a solution. What is the best way to return a 404 error from inside a controller?
kristiwr commented
I found a solution in the view helper. Here's the code I used:
view('errors/404.twig', $context, 404);
It would be helpful if the procedure for returning a 404 were explained in the HTTP Responses section in the docs.