protected function create(array $data)
//create confirmation code
$confirmation_code = str_random(30);
//main bulk of user creation
$user = User::create([
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'confirmation_code' => $confirmation_code,
//link to a role
$role_client = Role::where('name', 'client')->first();
//send mail upon user creation
function can be found in Auth/RegisterController.php
Make sure to customise the fillable if you’ve modified the table, or you may get an error similar to “General error: 1364 Field 'confirmation_code' doesn't have a default value”. This means you are passing an empty value to the table.
It’s preferable you don’t remove the STRICT mode. As good practice you should always have it on and be aware of what you are passing the correct type to the database.
For testing purposes we’ll use mailtrap; change the mail environment variables in the .env file to your credentials.