Routes

Contact

Overview

This code defines contact-related routes in Ecom API application. It includes a GET route for health checks (contact/_ping) and two POST routes for feedback (contact/feedback) and care forms (contact/care). Each route is managed by a specific controller, ensuring organized and maintainable code.


Submit Feedback

  • Route: POST ../contat/feedback
  • Controller: FeedbackController
  • Method: __invoke
  • Request: ContactRequest
  • Description: Endpoint to submit customer feedback.

The __invoke method in the FeedbackController validates the incoming feedback using the ContactRequest class. It then queues a FeedbackMail to send the feedback details via email. After queuing the email, the method returns a 204 No Content response to indicate successful processing.


Submit Care Form

  • Route: POST ../contat/care
  • Controller: CareFormController
  • Method: __invoke
  • Request: CareFormRequest
  • Description: Endpoint to submit a care form.

The __invoke method in the CareFormController processes the care form submission. It validates the incoming data using the CareFormRequest class, which ensures that all required fields are correctly filled and meet specified criteria. After validation, the method queues a CareForm email with the validated information. This email is sent to the appropriate recipient for further processing. The method returns a 200 OK response to indicate that the request has been successfully handled and the email has been queued.



Copyright © 2026