public static function setLangAttribute($request)
    {
        // language may be present in url without {param} defined
        $languageSlug= self::setFromURL($request);
        if(!$languageSlug) {
            $languageSlug = App::getLocale();
        }

        //add lang parameter to every route/action request if user is accessing a language that's different than default
        if(config('project.multilanguage')) {
            // hide slug on default language in frontend
            //backend
            if (!isInAdmin()) {
                if (config('project.hideDefaultLanguageInURL') && $languageSlug ==  Language::getDefault('slug')) {
                    $languageSlug = '';
                }
            }

            URL::defaults(['lang' => $languageSlug]);
        }

        return;
    }
public static function setLangAttribute($request)
    {
        // language may be present in url without {param} defined
        $languageSlug= self::setFromURL($request);
        if(!$languageSlug) {
            $languageSlug = App::getLocale();
        }

        //add lang parameter to every route/action request if user is accessing a language that's different than default
        if(config('project.multilanguage')) {
            // hide slug on default language in frontend
            //backend
            if (!isInAdmin()) {
                if (config('project.hideDefaultLanguageInURL') && $languageSlug ==  Language::getDefault('slug')) {
                    $languageSlug = '';
                }
            }

            URL::defaults(['lang' => $languageSlug]);
        }

        return;
    }
public static function setLangAttribute ( $ request ) { // language may be present in url without {param} defined $ languageSlug = self :: setFromURL ( $ request ) ; if ( ! $ languageSlug ) { $ languageSlug = App :: getLocale ( ) ; } //add lang parameter to every route/action request if user is accessing a language that's different than default if ( config ( 'project.multilanguage' ) ) { // hide slug on default language in frontend //backend if ( ! isInAdmin ( ) ) { if ( config ( 'project.hideDefaultLanguageInURL' ) && $ languageSlug == Language :: getDefault ( 'slug' ) ) { $ languageSlug = '' ; } } URL :: defaults ( [ 'lang' => $ languageSlug ] ) ; } return ; }
Set route lang attribute to all route request.

@param  Request $request
@return void
Set route lang attribute to all route request .