コード例 #1
0
 /**
  * This function changes the language om the competences table in the database.
  * This is done by checking the language from the parameter and then make
  * an update in the table
  * @param type $language
  */
 private function competenceLanguage($language)
 {
     $competences = \App\Competence::all();
     $increment = 0;
     if ($language == 'en') {
         foreach ($competences as $competence) {
             $increment++;
             \App\Competence::where('id', $increment)->update(['name' => trans_choice('localization.competences', $increment)]);
         }
     } elseif ($language == 'sv') {
         foreach ($competences as $competence) {
             $increment++;
             \App\Competence::where('id', $increment)->update(['name' => trans_choice('localization.competences', $increment)]);
         }
     } elseif ($language == 'tr') {
         foreach ($competences as $competence) {
             $increment++;
             \App\Competence::where('id', $increment)->update(['name' => trans_choice('localization.competences', $increment)]);
         }
     }
 }