webman icon indicating copy to clipboard operation
webman copied to clipboard

laravel orm日期字段返回返回值问题

Open lobtao opened this issue 3 years ago • 0 comments

`<?php /**

  • This file is part of webman.
  • Licensed under The MIT License
  • For full copyright and license information, please see the MIT-LICENSE.txt
  • Redistributions of files must retain the above copyright notice.
  • @author walkor[email protected]
  • @copyright walkor[email protected]
  • @link http://www.workerman.net/
  • @license http://www.opensource.org/licenses/mit-license.php MIT License */

namespace support;

use DateTimeInterface; use Illuminate\Database\Eloquent\Model as BaseModel;

class Model extends BaseModel {

/**
 * 日期字段格式化为当前app.default_timezone时区返回,默认为UTC 0时区返回
 * @param DateTimeInterface $date
 * @return string
 */
protected function serializeDate(DateTimeInterface $date): string
{
    return $date->format('Y-m-d H:i:s');
}

} `

lobtao avatar Sep 02 '21 05:09 lobtao