belongsTo(User::class, 'user_id'); } public function worker() { return $this->belongsTo(Worker::class, 'worker_id'); } public function replies() { return $this->hasMany(SupportTicketReply::class, 'support_ticket_id'); } /** * Get the creator of the ticket (either User/Employer or Worker). */ public function creator() { if ($this->user_id) { return $this->user; } return $this->worker; } }