jeudi 26 septembre 2019

How to apply a session value to drop down list using blade in Laravel

I've been racking my head and can't seem to find something that will work to apply Laravel session value to selected value for drop-down menu. Here's the code I currently have. Greatly appreciate any help. Thanks.

<select class="form-control ml-2" style="width: 300px;" name="memberNameFilter" id="memberNameFilter">
    <option value="-1">Member Name All</option>
    @foreach($member_names as $names)
    <option value="" @if($names->MemberName == request()->session()->get('memberNameFilter')) selected="selected" @endif></option>
    @endforeach
</select>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire