Laravel-Challenge-Movie-Table-Eloquent icon indicating copy to clipboard operation
Laravel-Challenge-Movie-Table-Eloquent copied to clipboard

Belce1982 solution - 3 Queries - 1000 Models - 23 MB

Open belce1982 opened this issue 3 years ago • 1 comments

    $movies = Movie::with('ratings','category')
        ->withAvg('ratings', 'rating')
        ->orderByDesc('ratings_avg_rating')
        ->take(100)
        ->get();

belce1982 avatar Sep 21 '21 14:09 belce1982

After putting foreign keys for ratings and category it goes down to 110 Models

belce1982 avatar Sep 21 '21 15:09 belce1982