I am a newbie in laravel. In my database, I have two tables, News(id, id_type) and Type(idtype,name). And in post News page, I use dropdown to select Type for my new news. So, when I want to show the type name of this News, I do:
<div class="controls">
<select multiple name="Type">
@foreach($type as $type)
<option
@if($news->id_type == $type->idtype)
selected="selected"
@endif
value="{{$type->idtype}}">{{$type->name}}</option>
@endforeach
</select>
</div>
But I have wrong result for all type in Type tables. Help me,please and thanks for your help!!