Below the code is giving the error in RegisterController when signingup.
protected function create( array $data ) {
$company = null;
$user_id = 0;
DB::transaction( function ( $data ) {
// Step 1 - Create User
$user = User::create( [
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'job_title' => $data['email'],
'phone' => $data['email'],
'email' => $data['email'],
'status' => 0,
'password' => Hash::make( $data['password'] ),
] );
// Create the Company
$user_id = $user->id;
if ( $user_id > 0 ) {
$company = Company::create( [
'user_id' => $user_id,
'name' => $data['company_name'],
'address' => $data['address'],
'city' => $data['company_city'],
'state' => $data['state'],
'zip_code' => $data['zip_code'],
'country' => $data['country'],
'notes' => $data['notes'],
'status' => 0,
] );
if ( $company->id > 0 ) {
return $user;
}
}
} );
}