0
I’m using Laravel freamwork where in my database I have 2 tables: -> complainants (with the field 'id','complainant','typoacoes_id') -> typos (with id fields, 'name')
Both are already with the Relationship in Model Complainant
public function tipoacao(){
return $this->hasMany(TipoAcoes::class, 'id', 'tipoacao_id');
}
Controller:
public function edit($id){
$titulo = "Edita Reclamante";
$reclamantes = $this->reclamante->find($id);
return view('admin.reclamante.create-edit', compact('titulo','reclamantes'));
}
But I am not able to bring the data with field 'name' of table 'typoacoes' within an imput select
<div class="input-group col-xs-12">
<select class="form-control" id="tipoacao_id" name="tipoacao_id" required value="{{$reclamantes->tipoacao->nome or old('$reclamantes->tipoacao->nome')}}">
@foreach($reclamantes as $Rel)
<option value="{{$Rel->tipoacao->id}}">{{$Rel->tipoacao->nome}}</option>
@endforeach
</select>
I think you can formulate a better question. Maybe with sample codes (maybe what you’re using), or a clearer question. The way it is, it’s hard to help you
– JrD
Thanks friend! I’m new around here this is my first question rs... I think with your advice gave p/ detail more!
– Leandro Sanjuan