Question

I'd like to register a user without metadata. I have this code but this

$user = Sentry::user()->register(array(
     'email' => Input::get('email'),
     'password' => Input::get('password')
));

but then I got this error:

SQLSTATE[HY000]: General error: 1364 Field 'first_name' doesn't have a default value

SQL: INSERT INTO `users_metadata` (`user_id`) VALUES (?)

Bindings: array ( 0 => 1, )

I'd really appreciate your help.

Was it helpful?

Solution

The SQL error suggests, that you have a field first_namein the table users_metadata, that is required. According to the source on github, metadata is optional on the create method.

I would check if the field first_name has allowed NULL values, and if not, allow it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top