|
|
@ -6,7 +6,15 @@ use Illuminate\Database\Eloquent\Model; |
|
|
class BaseModel extends Model |
|
|
class BaseModel extends Model |
|
|
{ |
|
|
{ |
|
|
protected $dateFormat = 'U'; |
|
|
protected $dateFormat = 'U'; |
|
|
# 不转换时间戳,若使用getUpdatedAtColumn,则不能自动写入时间戳
|
|
|
|
|
|
|
|
|
protected $host = ''; |
|
|
|
|
|
|
|
|
|
|
|
public function __construct(array $attributes = []) |
|
|
|
|
|
{ |
|
|
|
|
|
parent::__construct($attributes); |
|
|
|
|
|
$this->host = env('APP_URL'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# 不转换时间戳,若使用getUpdatedAtColumn,则不能自动写入时间戳
|
|
|
public function getUpdatedAtAttribute($value) |
|
|
public function getUpdatedAtAttribute($value) |
|
|
{ |
|
|
{ |
|
|
return strtotime($value); |
|
|
return strtotime($value); |
|
|
|