In Laravel 9, you'll be able to use the cool new "selected" Blade directive for HTML select elements.
This is going to be a nice addition that we can use to clean up our Blade views a little bit
1// Before Laravel 9: 2<select name="country"> 3 <option value="India" {{ old('country') ?? $country == 'India' ? 'selected' : '' }}>India</option> 4 <option value="Pakistan" {{ old('country') ?? $country == 'Pakistan' ? 'selected' : '' }}>Pakistan</option> 5</select> 6 7// Laravel 9 8<select name="country"> 9 <option value="India" @selected(old('country') ?? $country == 'India')>India</option>10 <option value="Pakistan" @selected(old('country') ?? $country == 'Pakistan')>Pakistan</option>11</select>
Tip given by @VijayGoswami