Chartjs-How change all dates in array into date without time – laravel

1πŸ‘

βœ…

In your model

class MyModel extends Model
{
    /**
     * Get created_at in date format ==> 1975-12-25
     *
     * @param  string  $value
     * @return string
     */
    public function getCreatedAtDateAttribute($value)
    {
        return $this->created_at->toDateString();
    }
}

then

var labels = {!! $object->pluck('created_at_date') !!};

Leave a comment