I'm newbie at Laravel and on stackoverflow. I'm making an app for registration. I want to show all those ids of section where class_id is selected in upper dropdown.
$cid=DB::table('classses')->get();
$counterr=0;
$sec=DB::table('sections')->where('class_id',$cid)->get();
$counterrr=0;
Dropdown menu for Class
<div class="col-md-6">
<select class="" name="class_id">
<option value="null">Class</option>
@foreach($cid as $cc)
@if($counterr==0)
<option selected="selected" value="{{$cc->id}}">{{$cc->title}}</option>
{$counterr++}}
@else
<option value="{{$cc->id}}">{{$cc->title}}</option>
@endif
@endforeach
</select>
Dropdown menu for Section where I want to get all the values of section where class_id is upper selected
<select section="" name="section_id">
<option value="null">Section</option>
@foreach($sec as $sc)
@if($counterrr==0)
<option selected="selected" value="{{$sc->id}}">{{$sc->title}}</option>
{{$counterrr++}}
@else
<option value="{{$sc->id}}">{{$sc->title}}</option>
@endif
@endforeach
</select>
Please help me in these case. You can freely ask anything if you want to.