<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class Experience extends Model
{

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

   public function descriptions($language_id= null)
    {
        if ($language_id) {
            $data = $this->hasMany(ExperienceDescription::class)->where('language_id', $language_id)->first();
            if(!$data){
                $data = $this->hasMany(ExperienceDescription::class)->first();
            }
            
            return $data;
        }
        return $this->hasMany(ExperienceDescription::class);
    }
   
}
