Attempt to fix N+1 issues

This commit is contained in:
Mark Gregory
2026-06-16 20:09:21 +01:00
parent 85b96144c0
commit e81a509007
6 changed files with 67 additions and 22 deletions
+15
View File
@@ -24,6 +24,21 @@ 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 = [
'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',