Variables refer to the same value

Posted 1 year ago by idodeva

Hi all,

I have database with lessons, which are translated in English and German. In the database I have two columns - one for English and one for German translations. When I declare the following in the controller the variables don't change their values, no matter what language is selected. The else clause is not working. For example if I check first for en, the variables return the English translation only. Same for German.

    foreach(Config::get('languages') as $lang => $language){
        if ($lang = 'en'){
            $lesson_name = $lessons->lessonen;
            $lesson_desc = $lessons->descriptionen;
        }else{
            $lesson_name = $lessons->lessonde;
            $lesson_desc = $lessons->descriptionde;
        }
    } 

Do you know what could be causing this?

Thanks

Please sign in or create an account to participate in this conversation.