Answer the question
In order to leave comments, you need to log in
How to do validation in laravel?
there is a form for adding information in different languages
How to implement validation so that the fields are filled, at least for $language->id = 1
@foreach($languages as $row=>$language)
<div class="tab-pane fade show @if ($row == 0) active @endif" id="language{{$language->id}}" role="tabpanel">
<div class="form-group">
<label for="">ФИО</label>
<input type="text" class="form-control @error('username') is-invalid @enderror" name="jury_description[{{$language->id}}][username]" required value="@isset($jury) {{$jury->username}} @endisset"> @error('username')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span> @enderror
</div>
</div>
@endforeach
public function rules()
{
return [
'username' => ['required', 'string', 'max:255'],
'description' => ['required', 'string', 'max:255'],
'image' => ['required', 'string', 'max:255'],
];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question