/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $now = date('Y-m-d H:i:s', strtotime('now'));
     $languages = [['name' => 'english', 'description' => 'the Language English', 'created_at' => $now, 'updated_at' => $now], ['name' => 'danish', 'description' => 'the Language Danish, spoken in Denmark', 'created_at' => $now, 'updated_at' => $now], ['name' => 'pashto', 'description' => 'the Language Pashto, spoken in Afghanistan', 'created_at' => $now, 'updated_at' => $now]];
     foreach ($languages as $language) {
         if (\App\Models\Language::where('name', '=', $language['name'])->exists()) {
             echo $language['name'] . " Already exists\n";
         } else {
             \App\Models\Language::create($language);
         }
     }
     //DB::table('words')->truncate();
     //Schema::drop('words');
     $passed = 0;
     $exists = 0;
     //word table - seed from a file
     //        $pashto_json = File::get(storage_path() . "/app/json_data/pashto.json");
     //	$pashto_word = json_decode($pashto_json);
     //
     //        foreach ($pashto_word as $wordObj)
     //        {
     //            if(\App\Models\Word::where('word', '=', $wordObj->s2p[0])->exists())
     //            {
     //                  echo $wordObj->s2p[0] . " Already exists\n";
     //                  $exists++;
     //            }
     //            else
     //            {
     //                 \App\Models\Word::create([
     //                    'language_id' => 3,
     //                    'user_id' => 3,
     //                    'word' => $wordObj->s2p[0],
     //                    'pronounce_audio_path' => '',
     //                    'pronounce_text' => 'pronounce_text missing',
     //                    'definition' => 'Word definition missing',
     //                    'created_at' => $now,
     //                    'updated_at' => $now,
     //                ]);
     //
     //                $passed++;
     //            }
     //        }
     foreach (File(storage_path() . "/app/danskOrde_49389.txt", FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES) as $word) {
         if (App\Models\Word::where(['language_id' => 2, 'word' => $word])->exists()) {
             echo $word . ": Already exists in Danish\n";
             $exists++;
         } else {
             App\Models\Word::create(['language_id' => 2, 'user_id' => 3, 'word' => $word, 'pronounce_audio_path' => '', 'pronounce_text' => 'pronounce_text missing', 'definition' => 'Word definition missing', 'created_at' => $now, 'updated_at' => $now]);
             $passed++;
         }
     }
     echo "\n Words Already Exists: " . $exists;
     echo "\n Words added: " . $passed . "\n";
 }
 public function run()
 {
     Eloquent::unguard();
     $languages = [['name' => 'English', 'locale' => 'en'], ['name' => 'Italian', 'locale' => 'it'], ['name' => 'German', 'locale' => 'de'], ['name' => 'French', 'locale' => 'fr'], ['name' => 'Brazilian Portuguese', 'locale' => 'pt_BR'], ['name' => 'Dutch', 'locale' => 'nl'], ['name' => 'Spanish', 'locale' => 'es'], ['name' => 'Norwegian', 'locale' => 'nb_NO'], ['name' => 'Danish', 'locale' => 'da'], ['name' => 'Japanese', 'locale' => 'ja'], ['name' => 'Swedish', 'locale' => 'sv'], ['name' => 'Spanish - Spain', 'locale' => 'es_ES'], ['name' => 'French - Canada', 'locale' => 'fr_CA'], ['name' => 'Lithuanian', 'locale' => 'lt'], ['name' => 'Polish', 'locale' => 'pl'], ['name' => 'Czech', 'locale' => 'cs']];
     foreach ($languages as $language) {
         $record = Language::whereLocale($language['locale'])->first();
         if ($record) {
             $record->name = $language['name'];
             $record->save();
         } else {
             Language::create($language);
         }
     }
     Eloquent::reguard();
 }
 public function run()
 {
     Eloquent::unguard();
     // https://github.com/caouecs/Laravel-lang
     // https://www.loc.gov/standards/iso639-2/php/code_list.php
     $languages = [['name' => 'English', 'locale' => 'en'], ['name' => 'Italian', 'locale' => 'it'], ['name' => 'German', 'locale' => 'de'], ['name' => 'French', 'locale' => 'fr'], ['name' => 'Brazilian Portuguese', 'locale' => 'pt_BR'], ['name' => 'Dutch', 'locale' => 'nl'], ['name' => 'Spanish', 'locale' => 'es'], ['name' => 'Norwegian', 'locale' => 'nb_NO'], ['name' => 'Danish', 'locale' => 'da'], ['name' => 'Japanese', 'locale' => 'ja'], ['name' => 'Swedish', 'locale' => 'sv'], ['name' => 'Spanish - Spain', 'locale' => 'es_ES'], ['name' => 'French - Canada', 'locale' => 'fr_CA'], ['name' => 'Lithuanian', 'locale' => 'lt'], ['name' => 'Polish', 'locale' => 'pl'], ['name' => 'Czech', 'locale' => 'cs'], ['name' => 'Croatian', 'locale' => 'hr'], ['name' => 'Albanian', 'locale' => 'sq']];
     foreach ($languages as $language) {
         $record = Language::whereLocale($language['locale'])->first();
         if ($record) {
             $record->name = $language['name'];
             $record->save();
         } else {
             Language::create($language);
         }
     }
     Eloquent::reguard();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement("SET foreign_key_checks = 0");
     Language::truncate();
     Language::create(['language_name' => 'Marathi']);
     Language::create(['language_name' => 'Hindi']);
     Language::create(['language_name' => 'Bengali']);
     Language::create(['language_name' => 'Tamil']);
     Language::create(['language_name' => 'Telugu']);
     Language::create(['language_name' => 'Malyalam']);
     Language::create(['language_name' => 'Bhojpuri']);
     Language::create(['language_name' => 'Maithili']);
     Language::create(['language_name' => 'Punjabi']);
     Language::create(['language_name' => 'Haryani']);
     Language::create(['language_name' => 'Gujrati']);
     Language::create(['language_name' => 'Odiya']);
     Language::create(['language_name' => 'Tulu']);
 }