일부 유효성 검사가 포함 된 양식이 있습니다. 유효성 검사가 끝나면 각 입력 필드에 대해 오류를 표시해야하고 $errors->first('organizations')
을 사용하여 오류를 시도했지만 작동하지 않는 것 같아 화면에 $errors->first('organizations')
이 인쇄됩니다. 아래는 내 코드 스 니펫입니다. 누군가 내가 잘못하고있는 것을 지적 할 수 있습니까?각 필드에 대해 Laravel 5.3의 오류가 표시됩니다.
<div class="form-group has-feedback {{ $errors->has('organization') ? 'has-error' : '' }}">
<label class="control-label" style="{{ $errors->has('organization') ? '' : 'display:none !important;' }}" for="organization"><i class="fa fa-times-circle-o"></i> {{ $errors->has('organization') ? '$errors->first("organization")' : '' }}</label>
<select class="form-control" placeholder="Organization" id="organization" name="organization">
<option value="0" style="display: none !important;" disabled selected>Organization</option>
@foreach ($organizations as $organizations)
<option value="{{ $organizations->orgid }}">{{ $organizations->orgname }}</option>
@endforeach
</select>
</div>
'$ errors-> first ('organizations ')를 제거해야합니다. 즉, PHP 코드가 아닌 문자열과 문자열로 변환됩니다. –
예 사실, 이제 코드가 '@if ($ errors-> has ('organization '))로 변경되었음을 알게되었습니다. \t \t \t \t \t @ endif' 이것은 내 문제를 해결합니다. – JackSlayer94