예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if ($this->command->confirm('Install default ingredient and recipe categories?')) {
         $ingredientCategories = explode("\n", file_get_contents(database_path('seeds/lists/ingredient-categories.csv')));
         foreach ($ingredientCategories as $ingredientCategory) {
             $term = Term::where([['vocabulary_id', '=', Vocabularies::INGREDIENT_CATEGORIES], ['name', '=', $ingredientCategory]])->first();
             if (!$term) {
                 Term::create(['vocabulary_id' => Vocabularies::INGREDIENT_CATEGORIES, 'name' => $ingredientCategory]);
             }
         }
     }
 }