<?php

namespace App\Http\Controllers;

use App\EstadoMunicipio;
use App\Municipio;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\User;


class MunicipioController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        return response()->json(Municipio::all());
    }

    public function byEstado(Request $request,$id)
    {
    	return response()->json(EstadoMunicipio::with('municipio')->where('estado_id',$id)->get());
    }

}