<?php

namespace Modules\Banner\Models;

use Modules\Product\Models\Product;
use Modules\Banner\Models\CountryDescription;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;

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

    protected $fillable = [
        'image','product_id'
    ];


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

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