settings updates, fixed

This commit is contained in:
Mark Gregory
2026-08-25 22:30:59 +01:00
parent 1cad54ce42
commit d359ac29b6
13 changed files with 61 additions and 815 deletions
+14 -7
View File
@@ -27,7 +27,7 @@ final class Ticket extends Model
protected $table = 'helpdesk_tickets';
protected $with = ['user', 'owner', 'agent'];
protected $with = ['user'];
/** @var list<string> */
protected $fillable = [
@@ -62,17 +62,24 @@ final class Ticket extends Model
return $this->belongsTo(User::class, 'user_id');
}
/**
* Compatibility alias for the requester.
*
* This is deliberately an accessor, not another BelongsTo relation.
* `owner()` and `user()` previously pointed to the same users.user_id
* relation and caused duplicate User relationship queries.
*/
public function getOwnerAttribute(): ?User
{
return $this->user;
}
public function tickets(): Ticket|HasMany
{
return $this->hasMany(Ticket::class, 'ticket_id');
}
/** @return BelongsTo<User, Ticket> */
public function owner(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
/** @return BelongsTo<User, Ticket> */
public function agent(): BelongsTo
{