class SendLoanReminderJob implements ShouldQueue (View source)

Job responsible for sending a loan reminder email.

This queued job sends an email to remind the user that the loan due date is approaching. By delegating this task to the EmailService, we ensure asynchronous processing, avoiding delays in the HTTP request and improving user experience.

Traits

Dispatchable
InteractsWithQueue
Queueable
SerializesModels

Properties

protected string $loanId

The unique identifier of the loan, used to fetch the necessary data.

Methods

__construct(string $loanId)

Create a new job instance.

void
handle(EmailService $emailService)

Execute the job to send the loan reminder email.

Details

__construct(string $loanId)

Create a new job instance.

Parameters

string $loanId

The ID of the loan used to generate the reminder email. The ID is converted from UUID to binary for database access.

void handle(EmailService $emailService)

Execute the job to send the loan reminder email.

This method retrieves the loan data based on the provided loan ID and triggers the email service to send the reminder to the user.

Parameters

EmailService $emailService

the service responsible for sending the reminder email

Return Value

void