You've already forked Atomcms-edit
Optimize queries: fix N+1, SELECT *, and missing eager loading
N+1 fixes:
- Add withCount('furniture') to rare categories sidebar (prevents N queries)
- Add tags and user.permission eager load in ArticleController
- Add rooms and photos.user eager load in ProfileController
- Add user eager load in MediaApiController (API was returning null user data)
SELECT * fixes:
- Replace WebsitePermission::all()->pluck() with direct pluck()
- Replace WebsiteHousekeepingPermission::all()->pluck() with direct pluck()
- Add select(['id', 'public_name']) to ItemBase query in furniItems()
- Add select(['id', 'name']) to help categories query
- Add select(['id', 'name', 'code']) to languages query
Memory/performance:
- Replace full collection load with aggregate queries in getRareStatistics()
- Add limit(50) to open tickets query in TicketController
This commit is contained in:
@@ -17,6 +17,7 @@ class MediaApiController extends Controller
|
||||
$photos = CameraWeb::query()
|
||||
->where('visible', true)
|
||||
->latest('id')
|
||||
->with('user:id,username,look')
|
||||
->paginate(12);
|
||||
|
||||
return response()->json([
|
||||
|
||||
Reference in New Issue
Block a user