ClearStudentRegistrationDrafts.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Services\StudentRegistrationDraftService;
  4. use Illuminate\Console\Command;
  5. class ClearStudentRegistrationDrafts extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'students:clear-registration-drafts';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = 'Remove os rascunhos de estudantes e suas reservas de CPF e e-mail';
  19. /**
  20. * Execute the console command.
  21. */
  22. public function handle(StudentRegistrationDraftService $service): int
  23. {
  24. $clearedDrafts = $service->clearAll();
  25. $this->components->info(
  26. trans_choice(
  27. '{0} Nenhum rascunho de estudante foi encontrado.|{1} Um rascunho de estudante foi removido.|[2,*] :count rascunhos de estudantes foram removidos.',
  28. $clearedDrafts,
  29. ['count' => $clearedDrafts],
  30. ),
  31. );
  32. return self::SUCCESS;
  33. }
  34. }