LandingPageService.php 860 B

1234567891011121314151617181920212223242526272829
  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. 'registration' => $data['registration'],
  17. 'phone' => $data['phone'],
  18. 'position_id' => $data['position_id'],
  19. 'sector_id' => $data['sector_id'],
  20. 'status' => UserStatusEnum::PENDING,
  21. 'type' => UserTypeEnum::ASSOCIADO,
  22. 'language' => LanguageEnum::PORTUGUESE,
  23. 'password' => bcrypt(Str::random(32)),
  24. ]);
  25. }
  26. }