Deploy Ladill Frontdesk / deploy (push) Failing after 26s
Enables staff roster, PIN/code kiosk flow, attendance reports, evacuation staff roll call, webhooks, branch mismatch warnings, and a linked-user My presence portal. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\EmployeePresence;
|
|
use App\Services\Frontdesk\NotificationDispatcher;
|
|
use Illuminate\Console\Command;
|
|
|
|
class EmployeeReturnAlertsCommand extends Command
|
|
{
|
|
protected $signature = 'frontdesk:employee-return-alerts';
|
|
|
|
protected $description = 'Alert staff when employees are overdue returning from step-out';
|
|
|
|
public function handle(NotificationDispatcher $notifications): int
|
|
{
|
|
$overdue = EmployeePresence::query()
|
|
->where('status', EmployeePresence::STATUS_STEPPED_OUT)
|
|
->whereNotNull('expected_return_at')
|
|
->where('expected_return_at', '<', now())
|
|
->whereNull('return_alert_sent_at')
|
|
->with(['employee.organization'])
|
|
->get();
|
|
|
|
$count = 0;
|
|
|
|
foreach ($overdue as $presence) {
|
|
$notifications->employeeOverdueReturn($presence);
|
|
$presence->update(['return_alert_sent_at' => now()]);
|
|
$count++;
|
|
}
|
|
|
|
$this->info("Sent {$count} overdue return alert(s).");
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|