public function setLanguage($language)
    {
        if ($this->getStorageMethod() == 'cookie') {
            return cookie()->forever($this->getLanguageKey(), $language);
        }
        if ( interface_exists( \Illuminate\Contracts\Session\Session::class ) && method_exists(\Illuminate\Contracts\Session\Session::class, 'put') ) {
            Session::put($this->getLanguageKey(), $language);
        } else {
            Session::set($this->getLanguageKey(), $language);
        }
        $this->registerLanguage();
        return cookie('dummy-cookie', FALSE, 1); //just for cleaner code in the controller
    }
public function setLanguage($language)
    {
        if ($this->getStorageMethod() == 'cookie') {
            return cookie()->forever($this->getLanguageKey(), $language);
        }
        if ( interface_exists( \Illuminate\Contracts\Session\Session::class ) && method_exists(\Illuminate\Contracts\Session\Session::class, 'put') ) {
            Session::put($this->getLanguageKey(), $language);
        } else {
            Session::set($this->getLanguageKey(), $language);
        }
        $this->registerLanguage();
        return cookie('dummy-cookie', FALSE, 1); //just for cleaner code in the controller
    }
public function setLanguage ( $ language ) { if ( $ this -> getStorageMethod ( ) == 'cookie' ) { return cookie ( ) -> forever ( $ this -> getLanguageKey ( ) , $ language ) ; } if ( interface_exists ( \ Illuminate \ Contracts \ Session \ Session :: class ) && method_exists ( \ Illuminate \ Contracts \ Session \ Session :: class , 'put' ) ) { Session :: put ( $ this -> getLanguageKey ( ) , $ language ) ; } else { Session :: set ( $ this -> getLanguageKey ( ) , $ language ) ; } $ this -> registerLanguage ( ) ; return cookie ( 'dummy-cookie' , FALSE , 1 ) ; //just for cleaner code in the controller }
Sets the language flag and returns the cookie to be created on the redirect
@param $language
@return mixed | null
Sets the language flag and returns the cookie to be created on the redirect