Events
Overview of WHAM Customer Events
The Toolstation\Customers\Events namespace contains various events that facilitate the management of customer accounts and interactions. Events such as CustomerUpdated, CustomerNoteCreated, and CustomerIssueCreated notify the application of changes and actions related to customer data, including updates to customer information, notes, and issues. Additionally, events like CustomerAddressCreated, CustomerAddressUpdated, and CustomerAddressDeleted track changes to customer addresses, while NoteAddedToCustomerIssue and CustomerIssueClosed enhance issue management by updating the status and context of customer concerns. Overall, these events enable efficient tracking and responsive actions throughout the customer lifecycle, ensuring that the system remains accurate and up-to-date.
The customer module fires the following events.
CustomerUpdated Event
The CustomerUpdated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a customer's details are updated. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customer, which is of typeCustomer. This property holds the instance of the customer that has been updated, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
Customerinstance as a parameter and assigns it to the$customerproperty. This provides the event with the specific customer information that has been modified, enabling listeners to react accordingly.
Note: This event is fired when a customer is updated.
CustomerNoteCreated Event
The CustomerNoteCreated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a new note has been created for a customer. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customerNote, which is of typeCustomerNote. This property holds the instance of the customer note that has been created, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerNoteinstance as a parameter and assigns it to the$customerNoteproperty. This provides the event with the specific customer note information that has been added, enabling listeners to react accordingly.
Note: This event is fired when a new note is created on a customer's account.
CustomerNoteUpdated Event
The CustomerNoteUpdated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a note on a customer's account is updated. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customerNote, which is of typeCustomerNote. This property holds the instance of the customer note that has been updated, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerNoteinstance as a parameter and assigns it to the$customerNoteproperty. This provides the event with the specific customer note information that has been modified, enabling listeners to react accordingly.
Note: This event is fired when a note is updated on a customer's account.
CustomerIssueCreated Event
The CustomerIssueCreated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when an issue is created on a customer's account. Below is a breakdown of its key elements:
Key Elements
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Properties:
$customerIssue: A public property of typeCustomerIssue, which holds the instance of the customer issue that has been created.$collectionSite: A public property of typeSystemSite|null, which represents the collection site associated with the customer issue. This property is optional and can be null.$supplierEmail: A public property of typestring|null, which holds the supplier's email address associated with the customer issue. This property is also optional and can be null.
- Constructor:
- The constructor method accepts three parameters: a
CustomerIssueinstance, an optionalSystemSiteinstance (for the collection site), and an optional string (for the supplier email). These parameters are assigned to their respective properties, allowing the event to carry relevant information about the created issue.
Note: This event is fired when an issue is created on a customer's account.
NoteAddedToCustomerIssue Event
The NoteAddedToCustomerIssue class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a note is added to a customer issue. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customerIssue, which is of typeCustomerIssue. This property holds the instance of the customer issue to which a note has been added, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerIssueinstance as a parameter and assigns it to the$customerIssueproperty. This provides the event with the specific customer issue information, enabling listeners to react accordingly.
Note: This event is fired when a note is created on a customer issue.
CustomerIssueNoteUpdated Event
The CustomerIssueNoteUpdated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a note on a customer issue is updated. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customerIssueNote, which is of typeCustomerIssueNote. This property holds the instance of the customer issue note that has been updated, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerIssueNoteinstance as a parameter and assigns it to the$customerIssueNoteproperty. This provides the event with the specific customer issue note information that has been modified, enabling listeners to react accordingly.
Note: This event is fired when a note on a customer issue is updated.
CustomerIssueClosed Event
The CustomerIssueClosed class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a customer issue is closed. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customerIssue, which is of typeCustomerIssue. This property holds the instance of the customer issue that has been closed, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerIssueinstance as a parameter and assigns it to the$customerIssueproperty. This provides the event with the specific customer issue information, enabling listeners to react accordingly.
Note: This event is fired when a customer issue is closed.
CatalogueRequestCreated Event
The CatalogueRequestCreated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a catalogue request is created. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$catalogueRequest, which is of typeCatalogueRequest. This property holds the instance of the catalogue request that has been created, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CatalogueRequestinstance as a parameter and assigns it to the$catalogueRequestproperty. This provides the event with the specific catalogue request information, enabling listeners to react accordingly.
Note: This event is fired when a catalogue request is created.
CustomerAttributeCreated Event
The CustomerAttributeCreated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a customer attribute is created. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customerAttribute, which is of typeCustomerAttribute. This property holds the instance of the customer attribute that has been created, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerAttributeinstance as a parameter and assigns it to the$customerAttributeproperty. This provides the event with the specific customer attribute information, enabling listeners to react accordingly.
Note: This event is fired when a customer attribute is created.
CustomerAddressCreated Event
The CustomerAddressCreated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a customer address is created. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$customerAddress, which is of typeCustomerAddress. This property holds the instance of the customer address that has been created, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerAddressinstance as a parameter and assigns it to the$customerAddressproperty. This provides the event with the specific customer address information, enabling listeners to react accordingly.
Note: This event is fired when a customer address is created.
CustomerAddressUpdated Event
The CustomerAddressUpdated class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a customer address is updated. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instances can be properly handled by queued jobs.
- Properties:
- The class includes two public properties:
$newAddress: This property is of typeCustomerAddressand holds the instance of the newly updated customer address.$expiredAddress: This property is also of typeCustomerAddressand holds the instance of the customer address that has been replaced or expired.
- Constructor:
- The constructor method accepts two
CustomerAddressinstances as parameters—$expiredAddressand$newAddress—and assigns them to the respective properties. This provides the event with the specific address information, enabling listeners to react accordingly.
Note: This event is fired when a customer address is updated.
CustomerAddressDeleted Event
The CustomerAddressDeleted class is an event defined in the Toolstation\Customers\Events namespace. This event is designed to notify other parts of the application when a customer address is deleted. Below is a breakdown of its key elements:
Key Elements:
- Namespace:
- The class is located within the
Toolstation\Customers\Eventsnamespace, indicating its relevance to customer-related events within the Toolstation application.
- Use Statement:
- The class uses the
SerializesModelstrait from Laravel. This trait enables the serialization of Eloquent models when the event is queued for processing, ensuring that the model instance can be properly handled by queued jobs.
- Property:
- The class includes a public property,
$address, which is of typeCustomerAddress. This property holds the instance of the customer address that has been deleted, allowing it to be accessed by any event listeners that respond to this event.
- Constructor:
- The constructor method accepts a
CustomerAddressinstance as a parameter and assigns it to the$addressproperty. This provides the event with the specific address information, enabling listeners to react accordingly.
Note: This event is fired when a customer address is deleted.