Define the selected option with the old input in Laravel / Blade

Instead of using Input class you can also use old() helper to make this even shorter.

<option {{ old('name') == $key ? "selected" : "" }} value="{{ $value }}">

The solution is to compare Input::old() with the $keyvariable using Blade Directives - If Statements.

@if (Input::old('title') == $key)
    <option value="{{ $key }}" selected>{{ $val }}</option>
@else
    <option value="{{ $key }}">{{ $val }}</option>
@endif

Also, you can use the ? operator to avoid having to use @if @else @endif syntax. Change:

@if (Input::old('title') == $key)
      <option value="{{ $key }}" selected>{{ $val }}</option>
@else
      <option value="{{ $key }}">{{ $val }}</option>
@endif

Simply to:

<option value="{{ $key }}" {{ (Input::old("title") == $key ? "selected":"") }}>{{ $val }}</option>