php last 12 month for Carbon

 avatar
unknown
php
3 years ago
466 B
4
Indexable
    public function last_carbon_month()
    {
        for ($i=0; $i <= 12 ; $i++) { 
            $last_month[$i] = new \stdClass;
            $last_month[$i]->date = Carbon::now()->subMonth($i)->isoFormat('Do.MM.YYYY');
            $last_month[$i]->text = Carbon::now()->subMonth($i)->isoFormat('Do MMM YYYY');
            $last_month[$i]->payments = "elma";
        }
        return Response::withData(true, 'last 12 mounth successfully listed', $last_month);
    }
Editor is loading...