0 && Recipe::count() > 0) { $comments = RecipeComment::factory()->count(5)->make(); $comments->each(static function ($comment): void { $comment->author()->associate( User::inRandomOrder() ->first() ->id ); $comment->recipe()->associate( Recipe::inRandomOrder() ->first() ->id ); $comment->saveOrFail(); }); } } }