Я пытаюсь отобразить подтверждение Ошибка Массаж в поле зрения store function
и update function
,
Я положил " добавить входы"и" редактировать ввод"в том же виде, поэтому я не могу знать, какая функция имеет ошибку проверки
это моя функция store code .. .
$rules = [
'section_name' => 'required|min:3',
'section_pic' => 'image',
];
$customMessages = [
'section_name.required' => 'Please Enter Section Name ',
'section_name.min' => 'Section Name Must Be At Least 3 Character ',
'section_pic.image' => 'You Should Choose Images Only',
];
$this->validate($request, $rules, $customMessages);
here some add code .....
return redirect('/Sections')->with('success_store','Success ! Your Section Added Successfully');
и это моя функция обновление код ...
$rules = [
'section_name' => 'required|min:3',
'section_pic' => 'image',
];
$customMessages = [
'section_name.required' => 'Enter Section Name You Want To Update to',
'section_name.min' => 'To Update Section Name Must Be At Least 3 Character ',
'section_pic.image' => 'To Update You Should Choose Images Only',
];
$this->validate($request, $rules, $customMessages);
some update code .....
return redirect('/Sections')->with('success_update','Success ! Your Section Updated Successfully');
и это в моем представлении ...
@if($errors->any())
<script type="text/javascript">
function openModal() {
$("#section_add").modal("show");
}
window.onload = openModal;
</script>
@endif
@if($errors->any())
<script type="text/javascript">
function openModal() {
$("#section_edit").modal("show");
}
window.onload = openModal;
</script>
@endif
это мои добавить входные данные в режиме добавления модальных ...
<input type="text" name="section_name" class="form-control name"
value="{{ old('section_name') }}" autofocus required>
@error('section_name')
<small class="text-danger">{{ $message }}</small>
@enderror
и это мои редактировать входные данные в режиме редактирования модальных ...
<input type="text" name="section_name" class="form-control name"
value="{{ old('section_name') }}" autofocus required>
@error('section_name')
<small class="text-danger">{{ $message }}</small>
@enderror