<?php

namespace Modules\Category\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\Category\Models\CategoryDescription;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;

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

    protected $fillable = [
        'category_id','visits','image'
    ];


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