DEV Community

loading...

Discussion on: Laravel: Performance Boost!

jringeisen profile image
Jonathon Ringeisen Author

@simpledevme you are correct! The following Eloquent query has the same improved performance. I'll edit the article this evening. Thank you for that information!

return Income::selectRaw("substr(date_income_received, 1, 4) as year")
            ->whereUserId($request->user()->id)
            ->groupBy('year')
            ->pluck('year');
Enter fullscreen mode Exit fullscreen mode
Forem Open with the Forem app