DEV Community

Discussion on: Laravel: Performance Boost!

 
jringeisen profile image
Jonathon Ringeisen

@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