ParkingController
extends BaseController
in package
Table of Contents
Methods
- checkParkingViaAPI() : void
- This function is used to check the status of a parking reservation using the external parking API and the provided reservation ID.
- checkRates() : View|JsonResponse|bool
- This function is used to fetch available parking rates for a given airport, arrival, and exit date.
- getDownloadMapImage() : BinaryFileResponse|Response
- This function is used to download or stream the terminal map for a given airport.
- getParkingData() : string
- This function is used to retrieve and prepare all data required for the airport parking page based on the airport code or ICAO identifier.
- parkingReserve() : string
- This function is used to prepare and return the parking reservation form for a specific parking lot and airport.
Methods
checkParkingViaAPI()
This function is used to check the status of a parking reservation using the external parking API and the provided reservation ID.
public
checkParkingViaAPI(Request $request) : void
Sends a GET request to the API and returns "success" or "failed" based on the reservation status.
Parameters
- $request : Request
-
The HTTP request containing the reservation ID in the URL segments.
Return values
void —Outputs "success" or "failed" and terminates execution.
checkRates()
This function is used to fetch available parking rates for a given airport, arrival, and exit date.
public
checkRates(Request $request) : View|JsonResponse|bool
Sends a POST request to the external parking API and returns a view with the resulting rate data. Returns a JSON error response if the API call fails or the input is invalid.
Parameters
- $request : Request
-
The HTTP request containing 'airport', 'arrival', and 'exit' parameters.
Return values
View|JsonResponse|boolgetDownloadMapImage()
This function is used to download or stream the terminal map for a given airport.
public
getDownloadMapImage(Request $request) : BinaryFileResponse|Response
Returns a PDF file if a terminal map document exists, or generates a PDF from an image if only a parking map image is available. Responds with a 404 error if the map is not found.
Parameters
- $request : Request
-
The HTTP request containing airport and map identifiers in the URL segments.
Return values
BinaryFileResponse|ResponsegetParkingData()
This function is used to retrieve and prepare all data required for the airport parking page based on the airport code or ICAO identifier.
public
getParkingData(Request $request, MetaService $metaService) : string
Fetches parking lot information from the database (including FAQs) and retrieves live rates and locations from an external parking API. Handles caching for guest users, error handling for missing airports, and composes all data for rendering the parking view.
Parameters
- $request : Request
-
The HTTP request containing airport code/ICAO and optional parameters.
- $metaService : MetaService
-
Service for generating meta tags and SEO content.
Return values
string —Rendered HTML content for the parking page.
parkingReserve()
This function is used to prepare and return the parking reservation form for a specific parking lot and airport.
public
parkingReserve(Request $request, MetaService $metaService) : string
Validates the reservation request using the provided id and key, retrieves airport and parking details, and compiles all necessary data for rendering the reservation form view.
Parameters
- $request : Request
-
The HTTP request containing reservation parameters (id, key, name, address, airport, arrival, exit).
- $metaService : MetaService
-
Service for generating meta tags and SEO content.
Return values
string —Rendered HTML content for the reservation form, or a 404 page if validation fails.