<?php


namespace App\Traits;


use Carbon\Carbon;
use DateTimeInterface;

trait ModelTimeFormat
{
    protected function serializeDate(DateTimeInterface $date)
    {
        if (version_compare(app()->version(), '7.0.0') < 0) {
            return parent::serializeDate($date);
        }

        return $date->format(Carbon::DEFAULT_TO_STRING_FORMAT);
    }
}
