diff --git a/database/seeders/RecipeSeeder.php b/database/seeders/RecipeSeeder.php index 939c789..5120977 100644 --- a/database/seeders/RecipeSeeder.php +++ b/database/seeders/RecipeSeeder.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Storage; use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; use App\Models\Recipe; +use App\Models\RecipeComment; use App\Models\RecipeAuthor; use App\Models\User; use Faker\Factory as FakerFactory; @@ -41,6 +42,14 @@ class RecipeSeeder extends Seeder ['name' => $faker->word, 'portion' => $faker->numberBetween(1, 20), 'unit' => $faker->randomElement(['teespoon', 'tablespoon', 'ml', 'pcs', 'clove', 'to_taste'])], ]; $recipe->save(); + for ($j = 0; $j < 10; $j++) { + $comment = new RecipeComment(); + $comment->user_id = User::inRandomOrder()->first()->id; + $comment->recipe_id = $recipe->id; + $comment->grade = $faker->randomElement([1,2,3,4,5]); + $comment->body = $faker->text(100); + $comment->save(); + } User::inRandomOrder()->first()->author_of_recipe()->attach($recipe->id); }