Level 104
Is dob included in the $fillable property on the User model?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, i am creating form and on my database my dob save as null help me for sort out this is my table
$table->date('dob');
here is my form
<div class="form-group{{ $errors->has('dob') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Date of Birth</label>
<div class="col-md-6">
<input type="text" class="span2" id="dp1" name="dob" value="{{ old('dob') }}">
@if ($errors->has('dob'))
<span class="help-block">
<strong>{{ $errors->first('dob') }}</strong>
</span>
@endif
</div>
</div>
this is on my controller
protected function validator(array $data)
{
return Validator::make($data, [
'username' => 'required|max:255|unique:users',
'firstname' => 'required|max:255',
'lastname' => 'required|max:255',
'gender' => 'required',
'dob' => 'required',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'username' => $data['username'],
'firstname' => $data['firstname'],
'lastname' => $data['lastname'],
'gender' => $data['gender'],
'dob' => $data['dob'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
Please or to participate in this conversation.