<?php

namespace App\Models;

use App\Models\User\UserModel;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\LogoutModel
 *
 * @property int $id
 * @property int|null $uid
 * @property \Illuminate\Support\Carbon $created_at
 * @property \Illuminate\Support\Carbon $updated_at
 * @property string $title 标题
 * @property string $content 内容
 * @property array $images 图片
 * @property int $reply_at
 * @property string $reply_content 回复内容
 * @property string $device 手机设备
 * @property string|null $phone 手机号码
 * @property string $unionid
 * @property array $search 搜索
 * @property-read \App\Models\User\UserModel|null $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereDevice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereImages($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel wherePhone($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereReplyAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereReplyContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereSearch($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereUnionid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\LogoutModel whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class LogoutModel extends Model
{
    //
    protected $table = 'kdgx_fpdx_logouts';

    protected $casts = [
        'images' => 'array',
        'search' => 'array',
    ];

    protected $fillable = [
        'uid',
        'title',
        'content',
        'images',
        'reply_at',
        'reply_content',
        'device',
        'phone',
        'search'
    ];

    protected $dateFormat = 'U';


    public function user()
    {
        return $this->belongsTo(UserModel::class, 'uid', 'uid')
            ->select('nickname', 'headimgurl', 'sex');
    }
}
