Skip to content

Commit

Permalink
Remove sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcyLina committed Jul 3, 2024
1 parent 2841c0a commit 037b891
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions app/Console/Commands/SendResourceDigestEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,18 @@ public function __construct()

public function handle()
{
$this->info('Starting to send resource digest emails.');

$resources = Resource::where('created_at', '>=', Carbon::now()->subDays(30))->get();

if ($resources->isEmpty()) {
$this->info('No resources created in the last 30 days. Email not sent.');

return;
}

$data = $resources->toArray();

User::where('is_subscriber', true)->chunk(100, function ($subscribedUsers) use ($data) {
$this->info('Processing a chunk of subscribed users.');
foreach ($subscribedUsers as $user) {
$this->info('Queueing email for user: ' . $user->email);
Mail::to($user->email)->queue(new ResourceDigestEmail(['details' => $data]));
}
});
Expand Down

0 comments on commit 037b891

Please sign in to comment.