I've resource controller in my Laravel project.
Route
Route::resource('products', 'ProductsController');
In the ProductController, I don't want to use show($id)
function because there is no need of this function in my project.
When I hit URL belongs to this controller it throws BadController error.
URL example: http://localhost/My-Project/products/123
This URL directly call to the show() function but I've removed that function to improve coding standards. But when any user hit that URL directly then it's throwing an error.
If anyone call that URL directly, it should throw 404 page not found.
Yes, I can handle the URL request by redirecting or other action in show() function, but I don't want to use unnecessary functions in my project.
Is there any way to throw 404 page not found without having the function?
GET
for that page? If so why not justRoute::get
? – giolliano sulit