<?php

namespace Modules\Category\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Modules\Banner\Models\Banner;
use Modules\Category\Models\CategoryDescription;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Product\Models\Product;
use Modules\Type\Models\Type;

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

    protected $fillable = [
        'start_price','image','end_price','lock'
    ];

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