-
-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Labels
feature requestNew feature or requestNew feature or request
Description
It would be convenient to have a short Route::isFallback()
method, for example when generating a locale switcher like this:
@foreach(config('localized-routes.supported-locales') as $locale)
@if ((Route::isLocalized() || Route::isFallback()) && ! App::isLocale($locale))
<a href="{{ Route::localizedUrl($locale) }}">{{ strtoupper($locale) }}</a>
@endif
@endforeach
Right now, Laravel doesn't have this method, so I added a macro to the boot()
method of the RouteServiceProvider
of my project:
Route::macro('isFallback', function () {
return Route::current() && Route::current()->isFallback;
});
I'm not sure if this is something I should add to this package or not, just for convenience...
For now, I'm just leaving it here for reference.
Metadata
Metadata
Assignees
Labels
feature requestNew feature or requestNew feature or request