How to show named error bag on view?

Named error bags allow you to pass the name of an error bag as an argument to the @error directive.

If there are multiple forms on a single page, you can name a MessageBag that contains validation errors, This allows you to retrieve the error messages for a specific form. To achieve this, we should pass a name as the second argument to withErrors method.

return redirect('register')->withErrors($validator, 'login');

You can then access the named MessageBag instance from the $errors variable, as shown below.

{{ $errors->login->first('email') 

Named error bag on view

You may use the @error directive as shown below to show a named error bag on view.

@error('name') {{ $message }} @enderror