addDays(7); $assets = Asset::with('assignedTo')->whereNotNull('assigned_to')->whereNotNull('expected_checkin')->where('expected_checkin', '<=', $whenNotify)->get(); $this->info($whenNotify.' is deadline'); $this->info($assets->count().' assets'); foreach ($assets as $asset) { if ($asset->assigned && $asset->checkedOutToUser()) { $asset->assigned->notify((new ExpectedCheckinNotification($asset))); } } if (($assets) && ($assets->count() > 0) && ($settings->alert_email != '')) { // Send a rollup to the admin, if settings dictate $recipients = collect(explode(',', $settings->alert_email))->map(function ($item, $key) { return new AlertRecipient($item); }); \Notification::send($recipients, new ExpectedCheckinAdminNotification($assets)); } } }