use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $dateFormat = 'U'; # 模型自动维护时间戳格式
protected $hidden = ['password', 'pay_password', 'salt'];
public function getCreatedAtAttribute($value) # 查询自动转化日期
{
return Carbon::createFromTimestamp($value)->toDateTimeString();
}
public function getUpdatedAtAttribute($value)
{
return Carbon::createFromTimestamp($value)->toDateTimeString();
}
}