123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use DateTimeInterface;
- class SoftBaseModel extends Model
- {
- use SoftDeletes;
-
- /**
- * 应该被调整为日期的属性
- *
- * @var array
- */
- protected $dates = ['deleted_at'];
-
- protected $guarded = [];
-
-
- /**
- * Laravel7 关于日期格式的改动 通过这个方法覆盖
- *
- * @param DateTimeInterface $date
- * @return string
- */
- protected function serializeDate(DateTimeInterface $date)
- {
- return $date->format('Y-m-d H:i:s');
- }
- }
|