validate
Validate function allows you to set rules for the data passed in the request. If the validation fails Laravel returns an Errors object.
// Controller file
public function store() {
request()->validate([
'FirstName' => 'required',
'SecondName' => 'required'
]);
}
// View file
@if ($errors->any())
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif
copy