You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
825 B

<?php
namespace App\Models;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use OwenIt\Auditing\Contracts\Auditable;
class CommonModel extends Model implements Auditable
{
use DynamicallyTableModelTrait;
use FilterRequestColumnModelTrait;
use \OwenIt\Auditing\Auditable;
protected $table;
protected $guarded = ['id'];
// 枚举型数据转换,数字转字符串
public static $intToString = [];
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
'deleted_at' => 'datetime:Y-m-d H:i:s',
];
public $glue = ",";
protected function serializeDate(DateTimeInterface $date)
{
return $date->format(Carbon::parse($date)->toDateTimeString());
}
}