Skip to content

Commit

Permalink
Merge pull request #1412 from bakaphp/cronjob-caddielab
Browse files Browse the repository at this point in the history
Cronjob caddielab
  • Loading branch information
FredPeal committed May 30, 2024
2 parents 36ea311 + 796198f commit 1795c06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class MailCaddieLabCommand extends Command
{
protected $signature = 'kanvas:internal-mail-caddie-lab {apps_id}';
protected $signature = 'kanvas:internal-mail-caddie-lab {apps_id} {email?}';

public function handle()
{
$this->info('Sending internal mail to Caddie Lab');
MailCaddieLabJob::dispatch(AppsRepository::findFirstByKey($this->argument('apps_id')));
MailCaddieLabJob::dispatch(AppsRepository::findFirstByKey($this->argument('apps_id'), $this->argument('email')));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class MailCaddieLabJob implements ShouldQueue
use Queueable;

public function __construct(
public Apps $app
public Apps $app,
public ?string $email = null
) {
}

Expand All @@ -52,7 +53,11 @@ public function sendMails(Collection $peoples, string $template, string $baseUrl
$notification->setSubject($subject);
echo ' Sending email to ' . $email->value . "\n";
if (! $people->get('paid_subscription')) {
Notification::route('mail', $email->value)->notify($notification);
$mail = $this->email ?? $email->value;
Notification::route('mail', $mail)->notify($notification);
if ($this->email) {
break;
}
}
}
}
Expand Down

0 comments on commit 1795c06

Please sign in to comment.