From 847b3fe54f2204eefb43fac3f57d127c96389e45 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 17 Aug 2023 16:12:08 +0200 Subject: [PATCH] feat: invite by email from waitlist --- app/Console/Commands/InviteFromWaitlist.php | 14 +++++++++++--- config/version.php | 2 +- versions.json | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/InviteFromWaitlist.php b/app/Console/Commands/InviteFromWaitlist.php index 4adc60693..2794b7441 100644 --- a/app/Console/Commands/InviteFromWaitlist.php +++ b/app/Console/Commands/InviteFromWaitlist.php @@ -19,21 +19,29 @@ class InviteFromWaitlist extends Command * * @var string */ - protected $signature = 'app:invite-from-waitlist'; + protected $signature = 'app:invite-from-waitlist {email?}'; /** * The console command description. * * @var string */ - protected $description = 'Send invitation to the next user in the waitlist'; + protected $description = 'Send invitation to the next user (or by email) in the waitlist'; /** * Execute the console command. */ public function handle() { - $this->next_patient = Waitlist::orderBy('created_at', 'asc')->where('verified', true)->first(); + if ($this->argument('email')) { + $this->next_patient = Waitlist::where('email', $this->argument('email'))->first(); + if (!$this->next_patient) { + $this->error("{$this->argument('email')} not found in the waitlist."); + return; + } + } else { + $this->next_patient = Waitlist::orderBy('created_at', 'asc')->where('verified', true)->first(); + } if ($this->next_patient) { $this->register_user(); $this->remove_from_waitlist(); diff --git a/config/version.php b/config/version.php index 7764582fa..7ea9c5731 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@