fixed N+1 issues

This commit is contained in:
Mark Gregory
2026-06-16 20:22:19 +01:00
parent a07bfd13df
commit 0b0a708a99
10 changed files with 200 additions and 112 deletions
-17
View File
@@ -24,22 +24,6 @@ final class Ticket extends Model
protected $table = 'helpdesk_tickets';
/**
* Relations that are repeatedly displayed in ticket lists/detail views.
*
* Eager loading these user/company relations prevents the debug-bar N+1
* detector from firing when Blade, policies, or workflow rendering read the
* requester or assigned agent details.
*
* @var list<string>
*/
protected $with = [
'user.company',
'owner.company',
'agent.company',
];
/** @var list<string> */
protected $fillable = [
'reference', 'company_id', 'user_id', 'agent_id', 'status_id', 'board_id', 'priority_id', 'category_id', 'project_id', 'team_id',
@@ -68,7 +52,6 @@ final class Ticket extends Model
'time_spent_minutes' => 'integer',
];
/** @return BelongsTo<User, Ticket> */
public function user(): BelongsTo
{