Files
ladill-care/app/Models/CareServiceQueue.php
isaaccladandCursor 6cf5a24019
Deploy Ladill Care / deploy (push) Successful in 1m28s
Add in-app Care Queue Engine (Phase 1 MVP).
Issue, call-next, serve, and complete tickets locally so Care Pro no longer
needs QUEUE_API_* when CARE_QUEUE_DRIVER=native (default). Remote Ladill Queue
remains available for cutover; PHPUnit keeps the remote driver for existing fakes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 09:54:06 +00:00

59 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use App\Models\Concerns\BelongsToOwner;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;
class CareServiceQueue extends Model
{
use BelongsToOwner;
protected $table = 'care_service_queues';
protected $fillable = [
'uuid', 'owner_ref', 'organization_id', 'branch_id', 'context',
'name', 'prefix', 'routing_mode', 'external_key', 'next_number', 'is_active',
];
protected function casts(): array
{
return [
'is_active' => 'boolean',
'next_number' => 'integer',
];
}
protected static function booted(): void
{
static::creating(function (CareServiceQueue $queue) {
if (! $queue->uuid) {
$queue->uuid = (string) Str::uuid();
}
});
}
public function organization(): BelongsTo
{
return $this->belongsTo(Organization::class, 'organization_id');
}
public function branch(): BelongsTo
{
return $this->belongsTo(Branch::class, 'branch_id');
}
public function points(): HasMany
{
return $this->hasMany(CareServicePoint::class, 'service_queue_id');
}
public function tickets(): HasMany
{
return $this->hasMany(CareQueueTicket::class, 'service_queue_id');
}
}