<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\UserInfo.
 *
 * @property int                        $user_id        user_id
 * @property int                        $integral       金币余额
 * @property int                        $total_integral 总金币
 * @property int                        $is_vip         是否VIP
 * @property string                     $start_at       VIP生效时间
 * @property string                     $end_at         VIP失效时间
 * @property string                     $opend_at       开卡时间
 * @property \Illuminate\Support\Carbon $updated_at     删除时间
 * @property string                     $deleted_at     删除时间
 * @property \Illuminate\Support\Carbon $created_at     创建时间
 *
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo query()
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereEndAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereIntegral($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereIsVip($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereOpendAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereStartAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereTotalIntegral($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo whereUserId($value)
 *
 * @mixin \Eloquent
 *
 * @property int $platform 用户平台 1-抖音 2-快手 ...
 *
 * @method static \Illuminate\Database\Eloquent\Builder|UserInfo wherePlatform($value)
 */
class UserInfo extends Model
{
    use HasFactory;
    protected $table = 'user_info';

    protected $primaryKey = 'user_id';

    protected $hidden = [
        'updated_at', 'deleted_at', 'created_at',
    ];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }
}
