<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Departamentos extends Model
{
    protected $table='departamentos';

    public function municipios () {
     	return $this->hasMany(Municipios::class, 'id_departamento', 'id');    
    }

    public function n_hoteles(){
    	return Hoteles_ubicaciones::where('id_departamento',$this->id)->whereHas('hotel',function($q){
            $q->where('publicado', 'S')->where('borrado','N');
        })->count();
    }
}
