class SendLoanReceiptJob implements ShouldQueue (View source)

Job responsible for sending a loan receipt email asynchronously.

This job sends a confirmation receipt to the borrower after a loan is created. By queuing this task, the system ensures the user's workflow is not delayed, providing a faster response time while the email is processed in the background.

Traits

Dispatchable
InteractsWithQueue
Queueable
SerializesModels

Properties

protected string $loanId

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

Methods

__construct(string $loanId)

Create a new job instance.

void
handle(EmailService $emailService)

Execute the job to send the loan receipt email.

Details

__construct(string $loanId)

Create a new job instance.

Parameters

string $loanId

The ID of the loan used to generate the receipt email. This ID is a UUID that will be converted to binary format for database queries.

void handle(EmailService $emailService)

Execute the job to send the loan receipt email.

This method fetches the loan from the database using its binary UUID and passes it to the EmailService for sending the loan receipt email.

Parameters

EmailService $emailService

the service responsible for sending the loan receipt email

Return Value

void

Exceptions

ModelNotFoundException