Skip to content

Instantly share code, notes, and snippets.

@brain2xml
Created March 8, 2022 11:00
Show Gist options
  • Save brain2xml/35072c4e2a01e85ccdd7efcae612d2b7 to your computer and use it in GitHub Desktop.
Save brain2xml/35072c4e2a01e85ccdd7efcae612d2b7 to your computer and use it in GitHub Desktop.
@if (count($errors) > 0)
<div class="error">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ $word->id == null ? route('words.store') : route('words.update', ['word'=>$word->id]) }}" method="post">
@csrf
@isset($word->id)
{{ method_field('PATCH')}}
@endisset
<div class="mb-3 col-lg-4">
<label for="f1" class="form-label">English</label>
<input id="f1" type="text" class="form-control {{ $errors->has('english') ? 'is-invalid' : '' }}" name="english" value="{!! old('english', optional($word)->english) !!}" />
@error('english')
<div class="form-text">{{ $errors->first('english') }}</div>
@enderror
</div>
<div class="mb-3 col-lg-4">
<label for="f2" class="form-label">Spanish</label>
<input id="f2" type="text" class="form-control {{ $errors->has('spanish') ? 'is-invalid' : '' }}" name="spanish" value="{!! old('spanish', optional($word)->spanish) !!}" />
@error('english')
<div class="form-text">{{ $errors->first('spanish') }}</div>
@enderror
</div>
<div class="mb-3 col-lg-4">
<label for="f3" class="form-label">Turkish</label>
<input id="f3" type="text" class="form-control {{ $errors->has('turkish') ? 'is-invalid' : '' }}" name="turkish" value="{!! old('turkish', optional($word)->turkish) !!}" />
@error('english')
<div class="form-text">{{ $errors->first('turkish') }}</div>
@enderror
</div>
<div class="mb-3 col-lg-4">
<label for="f4" class="form-label">Russian</label>
<input id="f4" type="text" class="form-control {{ $errors->has('russian') ? 'is-invalid' : '' }}" name="russian" value="{!! old('russian', optional($word)->russian) !!}" />
@error('english')
<div class="form-text">{{ $errors->first('russian') }}</div>
@enderror
</div>
<div>
<input type="submit" value="Save" />
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment