select option old value laravel 8 code example
Example 1: laravel old value for select option
@foreach($services as $service)
@if (old('category') == $service->id)
<option value="{{ $service->id }}" selected>{{ $service->title }}</option>
@else
<option value="{{ $service->id }}">{{ $service->title }}</option>
@endif
@endforeach
Example 2: laravel select default old value
<option value="{{ $key }}" {{ (Input::old("title") == $key ? "selected":"") }}>{{ $val }}</option>