<?php

namespace App\Models;

use App\Models\User\UserModel;

/**
 * App\Models\FeedbackModel
 *
 * @property int $id
 * @property int $uid uid
 * @property int $be_uid 举报者
 * @property string $title 标题
 * @property array $images 图片
 * @property string $content 内容
 * @property int $reply_at 回复时间
 * @property string $reply_content 回复内容
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property \Illuminate\Support\Carbon $updated_at 修改时间
 * @property string $device 手机设备
 * @property string $phone 联系方式
 * @property array $search 搜索
 * @property-read \App\Models\User\UserModel $userinfo
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereBeUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereDevice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereImages($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel wherePhone($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereReplyAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereReplyContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereSearch($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FeedbackModel whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class FeedbackModel extends Model
{
    protected $table = 'kdgx_fpdx_feedbacks';

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

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

    protected $dateFormat = 'U';

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