I am trying to create a user in laravel using laravel's own auth function. I have enabled it and want to add some of my own values to fields in the users table.
Right now I get this error, but dont know how to fix it. Any ideas? :
Array to string conversion (SQL: insert into users
(name
, email
, password
, activation_token
, is_active
, is_expert
, is_flag
, is_subscriber
, profile_img
, updated_at
, created_at
) values (Henrik Tobiassen, tarzan@hotmail.com, $2y$10$.xmKCnSdC8vogY47mbwRVOVehXJIedLMJ/gpfNgluPR9QpOtgyJ1m, 4633, 0, 0, 0, 0, uploads/profile_pics/default.jpg, 2019-03-10 21:12:29, 2019-03-10 21:12:29)
App/user.php
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'password', 'remember_token', 'activation_token', 'is_active', 'is_expert', 'is_flag', 'is_subscriber', 'profile_img',
];
RegisterController
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'activation_token' => [rand(1000, 9999)],
'is_active' => '0',
'is_expert' => '0',
'is_flag' => '0',
'is_subscriber' => '0',
'profile_img' => 'uploads/profile_pics/default.jpg',
]);
}