I want to specify that if anything entered in the url address other than existing routes (in routes.php, then show 404 page.
I know about this:
App::abort(404);
but how can I specify the part where everything else except the routes defined?
The fix was to rename parameters. Laravel doesn't accept minus character - . Rather than that you have to use camelCase or underscore ( _ ) variable naming conventions.
Error 404 not found is one of the most common issues you may encounter while browsing. This HTTP status code means the requested page can't be found on the website server. It may indicate a flaw with a hosting service or your domain name system (DNS) configuration settings.
It should be enough to just run php artisan vendor:publish --tag=laravel-errors and then edit the newly created resources/views/errors/404. blade.
You can add this to your filters.php file:
App::missing(function($exception)
{
return Response::view('errors.missing', array(), 404);
});
And create the errors.missing
view file to show them the error.
Also take a look at the Errors & Logging docs
EDIT
If you need to pass data to that view, the second parameter is an array you can use:
App::missing(function($exception)
{
return Response::view('errors.missing', array('url' => Request::url()), 404);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With