<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

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

class Category extends Model
{
    //
    use SoftDeletes;
    protected $fillable = [
        'image','active','increase','show','city','color','counter'
        ];
    /**
     * Get the description of the category.
     * @return HasMany
     */
    public function descriptions($language_id= 0) :HasMany
    {
        if ($language_id) {
            return $this->hasMany(CategoryDescription::class)->where('language_id', $language_id);
        }
        return $this->hasMany(CategoryDescription::class);
    }
    public function mainmodels(){
        return $this->hasMany(Models::class)->where('model_id',null);
    }
}
