<?php

namespace App\Models\Goodnight;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Goodnight\CommentModel
 *
 * @property int $id
 * @property int $uid 评论者
 * @property int $voice_id 语音ID
 * @property string $content 评论内容
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property \Illuminate\Support\Carbon $updated_at 修改时间
 * @property string $reply_content 回复内容
 * @property int $replyed_at 回复时间
 * @property int $deleted_at 删除时间
 * @property-read \App\Models\User\UserModel $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereReplyContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereReplyedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\CommentModel whereVoiceId($value)
 * @mixin \Eloquent
 */
class CommentModel extends Model
{
    //
    protected $table = 'kdgx_goodnight_voice_comments';

    protected $dateFormat = 'U';

    protected $fillable = ['uid', 'voice_id', 'content', 'reply_content', 'replyed_at', 'deleted_at'];


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