How to keep old value in select option when I updated the form?
Form:
<select class="form-select" name="slug" id="slug" value="{{$project->slug ?? '' }}">
<option value="">Select Category </option>
<option value="commercial">commercial</option>
</select>
>Solution :
You can use old() like this
<select class="form-select" name="slug" id="slug">
<option value="commercial" {{ old('slug', $project->slug) == 'commercial' ? 'selected' : '' }}>Commercial</option>
<option value="another" {{ old('slug', $project->slug) == 'another' ? 'selected' : '' }}>Another</option>
<option value="anotherrr" {{ old('slug', $project->slug) == 'anotherrr' ? 'selected' : '' }}>Anotherrr</option>
</select>