Laravel - Serialization - Customizing The Default Date Format

You may customize the default serialization format by overriding the serializeDate method. This method does not affect how your dates are formatted for storage in the database:

    
    /**
     * Prepare a date for array / JSON serialization.
     *
     * @param  \DateTimeInterface  $date
     * @return string
     */
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d');
    }