<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class DocumentComment extends Model
{
    protected $fillable = ['content', 'page', 'x', 'y', 'parent_id'];
    
    public function user() {
        return $this->belongsTo(User::class);
    }
    
    public function children() {
        return $this->hasMany(DocumentComment::class, 'parent_id');
    }
    
    public function parent() {
        return $this->belongsTo(DocumentComment::class, 'parent_id');
    }
}
