<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

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

class Ad extends Model
{
    //
    use SoftDeletes;
    protected $fillable = [
        'type','url'
        ];
    /**
     * Get the description of the Ad.
     * @return HasMany
     */
    public function descriptions($language_id= 0) :HasMany
    {
        if ($language_id) {
            return $this->hasMany(AdDescription::class)->where('language_id', $language_id);
        }
        return $this->hasMany(AdDescription::class);
    }
}
