In Laravel, when a user directly accesses a post route then an exception page is shown. How to show a 404 page instead?
To fix this issue :
Firstly, you need to create an error page in view folder of your project like 404.blade.php and put content in it (sample below):
Lastly, open your route file web.php and add following text to it:
In this, I have used get() to handle the request to post route. Now if anybody attempts to open this URL directly then automatically control transfers to the 404 page.