<?php

namespace Modules\Supplier\Models;

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

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

    protected $fillable =
    [
        'country_id',	'email'	,'phone'	,'address'	,'contract_date',	'note'
    ];

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

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