<?php

namespace App\Models\Syj;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Syj\TacitQuestionAnswerModel
 *
 * @property int $id
 * @property string $openid
 * @property array $questions 问题ID
 * @property array $answers 回答
 * @property \Illuminate\Support\Carbon $created_at
 * @property \Illuminate\Support\Carbon $updated_at
 * @property int $parent_id
 * @property string $uuid
 * @property-read \App\Models\Syj\UserModel $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereAnswers($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereOpenid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereParentId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereQuestions($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\TacitQuestionAnswerModel whereUuid($value)
 * @mixin \Eloquent
 */
class TacitQuestionAnswerModel extends Model
{
    //

    protected $table = 'syj_game_tacit_question_answers';

    protected $dateFormat = 'U';

    protected $fillable = ['openid', 'uuid', 'questions', 'answers', 'uuid', 'parent_id'];

    protected $casts = [
        'questions' => 'array',
        'answers' => 'array',
    ];


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