I'd like to go back through my app and refactor bits that are noticeably slow and/or causing performance bottlenecks. The starting point for me is to address potential lazy-loading and N+1 issues.
I have the following sort of things through my app in accessors.
public function getCourseTypeLabelAttribute()
{
return $this->courseType ? strtolower($this->courseType->name) : 'Unassigned';
}
Obviously here I'm calling course type name attribute without loading the course type in; how do I address these sorts of issues?