Support the ongoing development of Laravel.io →
Database Eloquent Blade
Last updated 1 year ago.
0

We won't just write the code for you. The Getting Started guide has information on all the relevant topics for this kind of code, though.

Last updated 1 year ago.
0

franzliedke said:

We won't just write the code for you. The Getting Started guide has information on all the relevant topics for this kind of code, though.

okay, so maybe you can give me some logic tips about what i trying to achieve, if you notice, my code is having n+1 problems since i need to 1 while loops for showing categories article and another while loops inside it for showing each article for categories and put them in the corret posittion

categories

article

article

article

so i tried to come up with this eloquent and it show categories and article for categories but only one article per categories..... maybe there is something i miss?

    $beritas = Artikel::with('KategoriArtikel')
                        ->where('pilihan','=','0')
                        ->orderBy('created_at','desc')
                        ->groupBy('kategori')
                        ->get();
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

t0n1zz t0n1zz Joined 8 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.