settings updates, fixed
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user