$data * @return array */ protected function mutateFormDataBeforeCreate(array $data): array { if (empty($data['password'])) { $data['password'] = Str::random(32); } return $data; } /** * Send an invitation email after the user is created so they can * set their own password via the admin panel reset flow. */ protected function afterCreate(): void { /** @var User $user */ $user = $this->record; $token = Password::broker()->createToken($user); $user->notify(new AdminInvitationNotification($token)); Log::info('User invited: '.$user->email); } }