The following routing rules limit the id to numbers. If it is not a number, an error will be reported. How to set it to prompt an incorrect parameter, a non-existent article, or jump to the homepage when it is not a number?
Route::get('article/{id}', function($id) {
return 'Article:' . $id;
})->where('id', '[0-9]+');
Method 1
Method 2
Create file
resourcesviewserrors404.blade.php
Non-existing routes will jump to this file, the specific processing is written in this file