<?php

namespace App\Models;

use Fwartner\Katching\Cacheable;
use Illuminate\Database\Eloquent\Model;

use Illuminate\Database\Eloquent\SoftDeletes;

class Comment extends Model
{
    use Cacheable, SoftDeletes;

    protected $table = 'comments';

    protected $fillable = [
        'content',
        'is_spam',
        'user_id',
        'thread_id'
    ];

    protected $casts = [
        'is_spam' => 'boolean'
    ];

    public function owner()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function forum()
    {
        return $this->belongsTo(Forum::class, 'forum_id');
    }

    public function thread()
    {
        return $this->belongsTo(Thread::class, 'thread_id');
    }
}
