mardi 28 août 2018

Laravel - GroupBy as Alias

I have the following in one of my functions but would like to refer to it as an alias named Date:

    $loads = $query->get()->groupBy(function($item)
                {
                  return Carbon::parse($item->dateTime)->format('F j, Y');
                });

This $query starts off as: $query = DB::table('loads')...

and the field dateTime is a timestamp.

Is there a proper way to do this to include the alias? Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire