<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Municipios extends Model
{
    protected $table='municipios';

    public function departamento () {
        return $this->belongsTo('App\Departamentos','id_departamento');
    }

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