$errors->has() and "is-invalid" related issue
$errors->has('accountable_id')
did not work
@if($errors->has('accountable_id'))
    <div class="invalid-feedback">
        <strong>{{ $errors->first('accountable_id') }}</strong>
    </div>
@endif
Until
is-invalid
class was specified
class="form-control {{ $errors->has('accountable_id') ? 'is-invalid' : '' }}"
The complete example
<div class="form-group">
    <label for="exampleSelect2">Accountable <span class="text-danger">*</span></label>
    <select class="form-control {{ $errors->has('accountable_id') ? 'is-invalid' : '' }}" id="accountable_id" name="accountable_id">
        <option value="">Select Accountable</option>
        @foreach($users as $accountable)
            <option value="{{ $accountable->id }}" {{ $accountable_id == $accountable->id ? 'selected' : '' }}>{{ $accountable->name }}</option>
        @endforeach
    </select>
    @if($errors->has('accountable_id'))
        <div class="invalid-feedback">
            <strong>{{ $errors->first('accountable_id') }}</strong>
        </div>
    @endif
</div>
by Valeri Tandilashvili
4 years ago
Laravel
validation
2
Pro tip: use ```triple backticks around text``` to write in code fences