<?php

namespace App\Models;

use App\Models\User\UserModel;

/**
 * App\Models\BlackListModel
 *
 * @property int $id
 * @property string $account_type 黑名单帐号类型
 * @property string $account 帐号
 * @property int $end_at 解封时间
 * @property string $type 类型
 * @property int $state 1=7天 2=30天 3=永久
 * @property int $created_at 封号时间
 * @property int $updated_at 修改时间
 * @property int $uid
 * @property int $complaint_id
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereAccount($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereAccountType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereComplaintId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereEndAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereState($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BlackListModel whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class BlackListModel extends Model
{
    protected $table = 'fpdx_blacklists';


    protected $dateFormat = 'U';

    protected $casts = [
        'created_at' => 'timestamp',
        'updated_at' => 'timestamp',
        'end_at' => 'timestamp',
    ];

    protected $fillable = ['uid', 'complaint_id', 'type', 'end_at', 'state', 'account_type', 'account'];


    public function user()
    {
        return $this->belongsTo(UserModel::class, 'uid', 'uid')
            ->select(
                'nickname',
                'headimgurl',
                'sex',
                'sxo',
                'height',
                'age',
                'home',
                'address',
                'school',
                'qq',
                'weixin',
                'pair_min_age',
                'pair_max_age',
                'wxkf'
            );
    }
}
