Correção ao criar usuários importado do excel

This commit is contained in:
marcio1002 2024-01-29 16:22:13 -03:00
parent 45befa9bb8
commit 206140111d

View File

@ -72,13 +72,19 @@ class UsersWithSmartUsersImport implements ToCollection
? $this->files_paths[$client_id] ? $this->files_paths[$client_id]
: ''; : '';
User::create(\compact(
/**
* @var ?\App\Models\User $user
*/
$user = User::create(\compact(
'client_id', 'client_id',
'name', 'name',
'email', 'email',
'password', 'password',
'profile_picture' 'profile_picture'
)); ));
$user?->roles()?->sync([2]);
} }
private function createSmartUserAccess(Collection $row, DadosCadastrais $client, string $email): void private function createSmartUserAccess(Collection $row, DadosCadastrais $client, string $email): void
@ -90,13 +96,18 @@ class UsersWithSmartUsersImport implements ToCollection
? $this->files_paths[$client_id] ? $this->files_paths[$client_id]
: ''; : '';
User::create(\compact( /**
* @var ?\App\Models\User $user
*/
$user = User::create(\compact(
'client_id', 'client_id',
'name', 'name',
'email', 'email',
'password', 'password',
'profile_picture' 'profile_picture'
)); ));
$user?->roles()?->sync([2]);
} }
private function uploadProfilePictures() private function uploadProfilePictures()