<?php

namespace App\Models;

use App\Traits\ShowCreatedUpdatedDeletedDate;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class BlogComment extends Model {
	use HasFactory, SoftDeletes;
	use ShowCreatedUpdatedDeletedDate;

	public $fillable = [
		'blog_id',
		'name',
		'email',
		'comment',
		'approved',
		'reply_id',
	];

	public function blog() {
		return $this->belongsTo(Blog::class);
	}

	public function replies() {
		return $this->hasMany(BlogComment::class, 'reply_id', 'id');
	}

	public function reply() {
		return $this->belongsTo(BlogComment::class, 'reply_id', 'id');
	}
}
