jeudi 13 juin 2019

How I can groupBy by date?

I'm using Laravel 5.8. I wan't to male a group by by date in the actual month. But the format of the raw is not just YY-mm-dd.

public function caGraphique () {
        $actualDate = Carbon::now('Europe/Paris');
        $ca = Order::selectRaw('sum(total_ttc) as sum, prepare_date')->groupBy('prepare_date')->where('prepare_date',[$actualDate->year.'-'.$actualDate->month])->get();
        return $ca;
    }


format of 'prepare_date' in my bdd

2019-06-07 12:59:51


This return an empty array



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire