Linked Questions

Popular Questions

Laravel groupby just like costum group by pipes

Asked by At

i have a problem to foreach the key from group by laravel.

here is mycode :

$testing = \DB::table(\DB::raw($query))
        ->where('total.content_file_download','not like','% %')
        ->where('total.updated_at','!=','0000-00-00 00:00:00')
        ->orderBy('total.updated_at','desc')->paginate(10)
        ->groupBy('month')->map(function ($group) {
                          return ["data" => $group ];
                          });

and it return so well until i cant foreach the key

the return

how can i give an array name on the key so i can foreach them

i want to use foreach like:

<ion-grid *ngFor="let item of allgallery">
        <ion-item>{{item}}</ion-item>
        <ion-row>
          <ion-col *ngFor="let element of item.data | slice:0:limit; let i=index">
<img [src]="'assets/img/no-img.jpg'" (click)="goView(element)"/>
          </ion-col>
        </ion-row>
</ion-grid>

The result that i want is like:
imageresult

Related Questions