servalsanti's avatar

Set runtime enviroment (es. APP_LOCALE) [beginner]

Hi there, i start learning lumen..it's awesome. Now, i want to set enviroment in runtime, because i want change language in error form display..is it possible?

0 likes
1 reply
servalsanti's avatar
servalsanti
OP
Best Answer
Level 1

resolved! i set enviroment with

app('config')->set('app.locale', $locale);

insert in helpers.php this function


if (! function_exists('setLang')) {
    /**
     * Set language locale.
     *
     * @param  string  $locale
     *
     */
    function setLang($locale)
    {
        app('config')->set('app.locale', $locale);
    }
}

sorry, i'm a newbie..

Please or to participate in this conversation.