$data['name'], 'username' => $data['username'], 'email' => $data['email'], 'password' => $data['password'], 'created_by' => $actor->id, ]); // The DB default (false) applies, but isn't hydrated back onto this // in-memory instance after insert — set it explicitly for the // response/event payload built from this same object. $user->two_factor_enabled = false; $user->assignRole($data['role']); return $user; } }