<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CommentInfoModel extends Model
{
    protected $table = 'comments_info';
    protected $fillable = [
        'interaction_id',
        'user_id',
        'user_avatar',
        'user_nickname',
        'to_user_id',
        'to_user_avatar',
        'to_user_nickname',
        'level',
        'content',
        'is_read',
    ];
    protected $hidden = ['dream_id','created_at','deleted_at'];


    public function CommentUser()
    {
        return $this->belongsTo('App\Models\UserInfoModel','user_id','id');
    }

    public function to_user()
    {
        return $this->belongsTo('App\Models\UserInfoModel');
    }

    public function dream()
    {
        return $this->hasOne('App\Models\DreamInfoModel','id','dream_id');
    }

    public function replay()
    {
        return $this->hasMany('App\Models\ReplyCommentsInfo','comment_id','id');
    }
}
