Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dsimensen's avatar

Can't register new user with username

I'm doing Laravel from scratch and I'm stuck here: https://laracasts.com/series/laravel-6-from-scratch/episodes/64?autoplay=true

I followed along, but I can't figure out why every time I try to register I get "The username field is required." on the username field. Here's what my the form for the username looks like:

<div class="form-group row">
   <label 
	for="username" 
	class="col-md-4 col-form-label text-md-right">
	Username
</label>

 	<div class="col-md-6">
	<input id="username" type="text"
		class="form-control @error('username') is-invalid @enderror"
		username="username" value="{{ old('username') }}" required
		autocomplete="username" autofocus>

@error('username')
	<span class="invalid-feedback" role="alert">
	<strong>{{ $message }}</strong>
	 </span>
@enderror
</div>
 </div>

sorry about the rough format. It's really hard to line it up.

0 likes
2 replies
MichalOravec's avatar
Level 75

You have to have name attribute name="username" and not username="username"

<input id="username" type="text"
    class="form-control @error('username') is-invalid @enderror"
    name="username" value="{{ old('username') }}" required
    autocomplete="username" autofocus>
dsimensen's avatar

AH! Wow, thanks. I just replaced everything with username I suppose.

Please or to participate in this conversation.