LandingPageService.php 833 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Services;
  3. use App\Enums\LanguageEnum;
  4. use App\Enums\UserStatusEnum;
  5. use App\Enums\UserTypeEnum;
  6. use App\Models\User;
  7. use Illuminate\Support\Str;
  8. class LandingPageService
  9. {
  10. public function registerUser(array $data): User
  11. {
  12. return User::create([
  13. 'name' => $data['name'],
  14. 'email' => $data['email'],
  15. 'cpf' => $data['cpf'],
  16. 'phone' => $data['phone'],
  17. 'position_label' => $data['position_label'],
  18. 'sector_label' => $data['sector_label'],
  19. 'status' => UserStatusEnum::PENDING,
  20. 'type' => UserTypeEnum::ASSOCIADO,
  21. 'language' => LanguageEnum::PORTUGUESE,
  22. 'password' => bcrypt(Str::random(32)),
  23. ]);
  24. }
  25. }