@@ -267,18 +267,15 @@ Not even when you create your custom `errors.404` view.
267267Therefor, the locale can't be set to match the requested URL automatically via middleware.
268268
269269To enable localized ` 404 ` pages, you need to register a ` fallback ` route
270- and make sure it has the ` SetLocale ` middleware and a name of ` 404 ` .
270+ and make sure it has the ` SetLocale ` middleware.
271271This is basically a catch all route that will trigger for all non existing URL's.
272272
273273``` php
274274Route::fallback(function () {
275275 return response()->view('errors.404', [], 404);
276- })->name('404')-> middleware(\CodeZero\LocalizedRoutes\Middleware\SetLocale::class);
276+ })->middleware(\CodeZero\LocalizedRoutes\Middleware\SetLocale::class);
277277```
278278
279- > Because you might use a ` fallback ` route for another purpose,
280- this package will only consider it to be a ` 404 ` if you name the route ` 404 ` .
281-
282279Another thing to keep in mind is that a ` fallback ` route returns a ` 200 ` status by default.
283280So to make it a real ` 404 ` you need to return a ` 404 ` response yourself.
284281
@@ -290,6 +287,8 @@ Fallback routes will not be triggered when:
290287
291288Because those routes are in fact registered, the ` 404 ` page will have the correct ` App::getLocale() ` set.
292289
290+ [ Here is a good read about fallback routes] ( https://themsaid.com/laravel-55-better-404-response-20170921 ) .
291+
293292### 🚕 Generate Route URL's
294293
295294You can get the URL of your named routes as usual, using the ` route() ` helper.
0 commit comments