<?php

namespace Modules\City\Models;

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

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

    protected $fillable = [
        'country_id'
    ];


    /**
     * Get current description of the the Room
     * @return HasOne
     */
    public function country()
    {
        return $this->belongsTo(Country::class)->withTrashed();
    }

    public function currentDescription() :HasOne
    {
        return $this->hasOne(CityDescription::class)->where('language_id', currentLanguage()->id);
    }
}
