0
My php code
public function getCadastro(Request $request)
{
$redes = Rede::lists('nome','id');
$municipios = Municipio::select('nome', 'id')->pluck('nome','id')->all();
$municipios_id = $request->has('municipio_id') ? $request->get('municipio_id') : null;
$regionais = Regional::select('nome', 'id')
->join('municipios','municipios.regional_id','=','regionais.id')
->where('municipios.id','=', $municipios_id);
return view('auth.cadastro',compact('redes', 'municipios', 'municipios_id', 'regionais'));
}
Here is my view
<div class="row">
<div class="col-sm-4">
{!! Form::label('municipio_id', 'Municipio*:') !!} <br/>
{!! Form::select('municipio_id',$municipios,$municipios_id,['class'=> 'form-control']) !!}
{!! $errors->first('municipio_id', '<span class="text-danger">:message</span> ') !!}
</div>
<div class="col-sm-4">
{!! Form::label('regional_id', 'Regional*:') !!} <br/>
{!! Form::select('regional_id',$regionais,null,['class'=> 'form-control']) !!}
{!! $errors->first('regional_id', '<span class="text-danger">:message</span> ') !!}
</div>
I’m new in PHP if you can help me.
What do you want to do basically? Be more detailed please!
– Rafael
You need to work with
Ajax
from what I could understand basically.– novic
vlw, I’ll search here. Thank you
– Nícolas santos Souza