i.e add required
on the form
request()->validate([
'title' => ['required', 'min:3'],
'description' => 'required'
]);
If validation fails user will be redirected back to the previous page and validation errors are sent through.
Errors can be accessed through the errors variable.
@if ($errors->any())
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
@endif
When validation fails, Laravel flashes the attributes to the session and we are fetching them
value="{{ old('title') }}"