TransportationController
extends BaseController
in package
Table of Contents
Methods
- cancelReservation() : Response
- This function is used to cancel a transportation reservation and process refund.
- checkReservation() : Response
- This function is used to display reservation lookup and management interface.
- checkReservationTrue() : Response
- This function is used to verify reservation details and retrieve booking information.
- citiesInfo() : Response
- This function is used to get the cities information for the transportation page.
- loadMoreTransport() : Response
- This function is used to load additional transportation options based on search criteria.
- processPayment() : JsonResponse
- This function is used to process payment for transportation reservation using Stripe.
- reservationSuccess() : Response
- This Display successful reservation confirmation page.
- reserveTransportation() : JsonResponse
- This function is used to store transportation reservation details in the database.
- transportationFromAutocomplete() : JsonResponse
- This Provide location autocomplete suggestions for transportation booking.
- transportationReserve() : Response
- This function is used to display transportation reservation form with booking details.
- transportationReserveUpdate() : Response
- This function is used to display transportation reservation update form.
- UpdateTransportatinReservation() : JsonResponse
- This function is used to update existing transportation reservation details.
Methods
cancelReservation()
This function is used to cancel a transportation reservation and process refund.
public
cancelReservation(Request $request) : Response
This method cancels a reservation through the Mozio API and automatically processes a full refund through Stripe for the original payment amount.
Parameters
- $request : Request
-
Contains reservation_id to be cancelled
Return values
Response —Success message or error details
checkReservation()
This function is used to display reservation lookup and management interface.
public
checkReservation(Request $request, MetaService $metaService) : Response
This method renders the reservation checking page where users can search for their existing bookings and manage reservation details through the interface.
Parameters
- $request : Request
-
Contains session data and preview parameters
- $metaService : MetaService
-
Service for managing meta information
Return values
Response —Rendered reservation management page
checkReservationTrue()
This function is used to verify reservation details and retrieve booking information.
public
checkReservationTrue(Request $request) : Response
This method validates a reservation by querying the Mozio API using the confirmation number and retrieves associated payment details from the local database.
Parameters
- $request : Request
-
Contains reservation_id for verification
Return values
Response —Rendered view with reservation details or error response
citiesInfo()
This function is used to get the cities information for the transportation page.
public
citiesInfo(Request $request, MetaService $metaService) : Response
This method processes transportation-related city data by extracting location information from URL segments and handling intelligent caching based on user agent detection. It optimizes performance by serving cached content for bots and regular users with different cache durations.
Parameters
- $request : Request
-
The incoming HTTP request containing URL segments and session data
- $metaService : MetaService
-
Service for managing meta information and SEO data
Return values
Response —Rendered view with city transportation information or 404 error
loadMoreTransport()
This function is used to load additional transportation options based on search criteria.
public
loadMoreTransport(Request $request) : Response
This method initiates a transportation search through the Mozio API using provided pickup/dropoff locations, travel date/time, and passenger count. It implements polling logic to wait for complete search results and organizes them by vehicle type.
Parameters
- $request : Request
-
Contains search parameters: from, to, travel-date-and-time, no_pass
Return values
Response —JSON response with transportation options or error details
processPayment()
This function is used to process payment for transportation reservation using Stripe.
public
processPayment(Request $request) : JsonResponse
This method handles the payment processing workflow by creating a Stripe payment intent, confirming the reservation with Mozio API, and storing customer payment details. It includes comprehensive error handling for various payment scenarios.
Parameters
- $request : Request
-
Contains payment details: price, resultID, searchID, stripeToken, etc.
Return values
JsonResponse —Payment processing result with success/error details
reservationSuccess()
This Display successful reservation confirmation page.
public
reservationSuccess(Request $request, MetaService $metaService) : Response
This method renders the success page after a completed transportation booking, retrieving reservation details from Mozio API and displaying confirmation information along with payment details.
Parameters
- $request : Request
-
Contains confirmation number and session data
- $metaService : MetaService
-
Service for managing meta information
Return values
Response —Rendered success page with booking confirmation
reserveTransportation()
This function is used to store transportation reservation details in the database.
public
reserveTransportation(Request $request) : JsonResponse
This method captures and stores reservation information including passenger details, flight information, and travel specifics for later processing and confirmation.
Parameters
- $request : Request
-
Contains passenger and booking details
Return values
JsonResponse —Success or failure status
transportationFromAutocomplete()
This Provide location autocomplete suggestions for transportation booking.
public
transportationFromAutocomplete(Request $request) : JsonResponse
This method queries the Mozio API for location suggestions based on user input, returning formatted results suitable for autocomplete functionality in the transportation booking interface.
Parameters
- $request : Request
-
Contains query parameter for location search
Return values
JsonResponse —JSON array of location suggestions
transportationReserve()
This function is used to display transportation reservation form with booking details.
public
transportationReserve(Request $request, MetaService $metaService) : Response
This method prepares the reservation interface by validating search and result IDs, retrieving airport information, and setting up the booking form with pre-filled transportation details and pricing information.
Parameters
- $request : Request
-
Contains booking parameters: result, search, locid, price, etc.
- $metaService : MetaService
-
Service for managing meta information
Return values
Response —Rendered reservation form or 404 error
transportationReserveUpdate()
This function is used to display transportation reservation update form.
public
transportationReserveUpdate(Request $request, MetaService $metaService) : Response
This method prepares the reservation modification interface by validating reservation IDs and retrieving current booking details for editing.
Parameters
- $request : Request
-
Contains reservation-id, search-id, and result-id
- $metaService : MetaService
-
Service for managing meta information
Return values
Response —Rendered update form or 404 error
UpdateTransportatinReservation()
This function is used to update existing transportation reservation details.
public
UpdateTransportatinReservation(Request $request) : JsonResponse
This method processes reservation modifications by validating updated passenger and flight information, then submits changes to the Mozio API for processing.
Parameters
- $request : Request
-
Contains updated reservation details: firstName, lastName, email, phone, etc.
Return values
JsonResponse —Success confirmation or error details