From 43c4a3c8f64a7d3d1fe62be8975b8fbc5b5a7110 Mon Sep 17 00:00:00 2001 From: Daniel Wilkowski Date: Wed, 2 Oct 2024 19:30:16 +0200 Subject: [PATCH] Add FakeSessionRepository --- app/Domain/Online/FakeSessionRepository.php | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/Domain/Online/FakeSessionRepository.php diff --git a/app/Domain/Online/FakeSessionRepository.php b/app/Domain/Online/FakeSessionRepository.php new file mode 100644 index 000000000..d94b4feeb --- /dev/null +++ b/app/Domain/Online/FakeSessionRepository.php @@ -0,0 +1,33 @@ +id(User::query()->inRandomOrder(rand(1, 100))), + guestsCount:\rand(450, 900), + ); + } + return new SessionsSnapshot( + users:[ + ...$this->id(User::query()->whereNotNull('group_name')->limit(1)), + ...$this->id(User::query()->inRandomOrder()->limit(\rand(5, 7))), + ], + guestsCount:\rand(5, 90), + ); + } + + private function id(Eloquent\Builder $builder): array + { + return $builder->pluck('id')->toArray(); + } +}