Attempt to fix N+1 issues still there and more now

This commit is contained in:
Mark Gregory
2026-06-16 20:15:22 +01:00
parent e81a509007
commit a07bfd13df
9 changed files with 65 additions and 72 deletions
+8
View File
@@ -35,6 +35,7 @@ final class Ticket extends Model
* @var list<string>
*/
protected $with = [
'user.company',
'owner.company',
'agent.company',
];
@@ -67,6 +68,13 @@ final class Ticket extends Model
'time_spent_minutes' => 'integer',
];
/** @return BelongsTo<User, Ticket> */
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
/** @return BelongsTo<User, Ticket> */
public function owner(): BelongsTo
{