Fix queue handoff so tickets keep their number across services.
Deploy Ladill Queue / deploy (push) Successful in 40s
Deploy Ladill Queue / deploy (push) Successful in 40s
Handoff now frees the counter, ends the service session, and requeues the same ticket for the next department — critical for hospital flows like doctor → lab. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -66,4 +66,9 @@ class Ticket extends Model
|
||||
{
|
||||
return $this->hasMany(TicketEvent::class, 'ticket_id');
|
||||
}
|
||||
|
||||
public function transfers(): HasMany
|
||||
{
|
||||
return $this->hasMany(TicketTransfer::class, 'ticket_id')->orderByDesc('transferred_at');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\BelongsToOwner;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class TicketTransfer extends Model
|
||||
{
|
||||
use BelongsToOwner;
|
||||
|
||||
protected $table = 'queue_ticket_transfers';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'owner_ref',
|
||||
'ticket_id',
|
||||
'from_service_queue_id',
|
||||
'to_service_queue_id',
|
||||
'from_counter_id',
|
||||
'reason',
|
||||
'transferred_by',
|
||||
'transferred_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'transferred_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function ticket(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ticket::class, 'ticket_id');
|
||||
}
|
||||
|
||||
public function fromQueue(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ServiceQueue::class, 'from_service_queue_id');
|
||||
}
|
||||
|
||||
public function toQueue(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ServiceQueue::class, 'to_service_queue_id');
|
||||
}
|
||||
|
||||
public function fromCounter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Counter::class, 'from_counter_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user