DEV Community

Discussion on: 5 tips for supercharged Laravel Eloquent queries

Collapse
 
glennmen profile image
Glenn Carremans

For your dynamic attributes example this already exists in Laravel.

Technicians::withCount('requests')->get();

Now every technician will have the requests_count attribute. laravel.com/docs/7.x/eloquent-rela...