<?php

namespace Modules\Faq\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\FaqCategory\Models\FaqCategory;

class Faq extends Model
{
    //use soft delete
    use SoftDeletes;

    protected $fillable = [
        'faq_category_id'
    ];


    /**
     * Get current description of the the Room
     * @return HasOne
     */
    public function currentDescription() :HasOne
    {
        return $this->hasOne(FaqDescription::class)->where('language_id', currentLanguage()->id);
    }

    public function faqCategory()
    {
        return $this->belongsTo(FaqCategory::class)->withTrashed();
    }
}
