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.
20 lines
482 B
20 lines
482 B
<?php
|
|
|
|
namespace App\Models;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BaseModel extends Model
|
|
{
|
|
protected $dateFormat = 'U';
|
|
# 不转换时间戳,若使用getUpdatedAtColumn,则不能自动写入时间戳
|
|
public function getUpdatedAtAttribute($value)
|
|
{
|
|
return strtotime($value);
|
|
}
|
|
|
|
# 不转换时间戳,若使用getUpdatedAtColumn,则不能自动写入时间戳
|
|
public function getCreatedAtAttribute($value)
|
|
{
|
|
return strtotime($value);
|
|
}
|
|
}
|