Array key on laravel controller group by
I want to get data plan by date, then I use carbon on laravel to get it. this my query on laravel controller $data = DB::table('visit_plan') ->join('outlets', 'outlets.id', '=', 'visit_plan.id_outlet') ->select('outlets.id', 'outlets.name') ->get() ->groupBy(function($date) { return $this->attributes['date'] = Carbon::parse($date->date)->format('Y-m-d'); });…