shlogg · Early preview
David Duymelinck @xwero

Laravel LocaleRoute Helper For Easier Routing

Laravel's Url::defaults method has a caveat: model binding issues. Use global middleware? No! Create a helper instead, like localeRoute() for easier route generation in Blade.

I just read the Laravel news post about the Url::defaults method.
The article doesn't mention it has a caveat, that can cause a model binding problem.
Why would you use global middleware to make it easier to get a route in blade in the first place?
A less invasive way to solve this is to create a helper.

function localeRoute($name, $parameters = [], $absolute = true)
{
    foreach (['locale' => 'en'] as $key => $value) {
        if(array_key_exists($key, $parameters)) {
            continue;
        }
        $parameters[$key] = $value;
    }
    return app('url')->route($name, $parameters, $...