<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class Reason extends Model
{
    //
    use SoftDeletes;
    protected $fillable = [
        'id',
        ];
    /**
     * Get the description of the category.
     * @return HasMany
     */
    public function descriptions($language_id= null)
    {
        if ($language_id) {
            $data = $this->hasMany(ReasonDescription::class)->where('language_id', $language_id)->first();
            if(!$data){
                $data = $this->hasMany(ReasonDescription::class)->first();
            }
            
            return $data;
        }
        return $this->hasMany(ReasonDescription::class);
    }
}
