public static function redirectToDefaultLanguage()
    {
        $getCurrentPath = Request::path();
        $explodePath = explode('/', $getCurrentPath);

        //only proceed if there is a language found in first path and that's default language
        if(App::getLocale() == Language::getDefault("slug")) {
            $countPaths = count($explodePath);
            $getLanguage = Language::findBySlug($explodePath[0]);

            if($getLanguage) {
                if($getLanguage->isDefault) {
                    if($countPaths >= 2 && $explodePath[0] && $explodePath[1]) {
                        $urlAfterLanguage = substr($getCurrentPath, 3);
                        Redirect::to($urlAfterLanguage, 301)->send();
                    }
                    //that's shall be default language
                    else if($countPaths == 1 && $explodePath[0]) {
                        Redirect::to('/', 301)->send();
                    }
                }
            }
        }
    }
public static function redirectToDefaultLanguage()
    {
        $getCurrentPath = Request::path();
        $explodePath = explode('/', $getCurrentPath);

        //only proceed if there is a language found in first path and that's default language
        if(App::getLocale() == Language::getDefault("slug")) {
            $countPaths = count($explodePath);
            $getLanguage = Language::findBySlug($explodePath[0]);

            if($getLanguage) {
                if($getLanguage->isDefault) {
                    if($countPaths >= 2 && $explodePath[0] && $explodePath[1]) {
                        $urlAfterLanguage = substr($getCurrentPath, 3);
                        Redirect::to($urlAfterLanguage, 301)->send();
                    }
                    //that's shall be default language
                    else if($countPaths == 1 && $explodePath[0]) {
                        Redirect::to('/', 301)->send();
                    }
                }
            }
        }
    }
public static function redirectToDefaultLanguage ( ) { $ getCurrentPath = Request :: path ( ) ; $ explodePath = explode ( '/' , $ getCurrentPath ) ; //only proceed if there is a language found in first path and that's default language if ( App :: getLocale ( ) == Language :: getDefault ( "slug" ) ) { $ countPaths = count ( $ explodePath ) ; $ getLanguage = Language :: findBySlug ( $ explodePath [ 0 ] ) ; if ( $ getLanguage ) { if ( $ getLanguage -> isDefault ) { if ( $ countPaths >= 2 && $ explodePath [ 0 ] && $ explodePath [ 1 ] ) { $ urlAfterLanguage = substr ( $ getCurrentPath , 3 ) ; Redirect :: to ( $ urlAfterLanguage , 301 ) -> send ( ) ; } //that's shall be default language else if ( $ countPaths == 1 && $ explodePath [ 0 ] ) { Redirect :: to ( '/' , 301 ) -> send ( ) ; } } } } }
Redirect url to default language if default language slug is given.

@throws \Exception
Redirect url to default language if default language slug is given .