Files
ladill-frontdesk/app/Models/EmployeePresence.php
T
isaaccladandCursor 890c2c71e3
Deploy Ladill Frontdesk / deploy (push) Failing after 26s
Add employee presence with kiosk sign-in, QR badges, and mobile step-out.
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>
2026-06-28 21:11:18 +00:00

64 lines
1.5 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class EmployeePresence extends Model
{
public const STATUS_OFF_SITE = 'off_site';
public const STATUS_ON_SITE = 'on_site';
public const STATUS_STEPPED_OUT = 'stepped_out';
protected $table = 'frontdesk_employee_presence';
protected $fillable = [
'employee_id', 'status', 'branch_id', 'device_id', 'destination',
'step_out_reason', 'notes', 'expected_return_at', 'return_alert_sent_at',
'signed_in_at', 'last_event_at',
];
protected function casts(): array
{
return [
'signed_in_at' => 'datetime',
'last_event_at' => 'datetime',
'expected_return_at' => 'datetime',
'return_alert_sent_at' => 'datetime',
];
}
public function employee(): BelongsTo
{
return $this->belongsTo(Employee::class, 'employee_id');
}
public function branch(): BelongsTo
{
return $this->belongsTo(Branch::class, 'branch_id');
}
public function device(): BelongsTo
{
return $this->belongsTo(Device::class, 'device_id');
}
public function isOnSite(): bool
{
return $this->status === self::STATUS_ON_SITE;
}
public function isSteppedOut(): bool
{
return $this->status === self::STATUS_STEPPED_OUT;
}
public function isOffSite(): bool
{
return $this->status === self::STATUS_OFF_SITE;
}
}