<?php

namespace App;

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

class Certification extends Model
{

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

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