FourSquareAPIController
extends Controller
in package
Table of Contents
Methods
- airportInfoByLocId() : stdClass
- This function is used to retrieve airport information from external GIS API using location ID.
- businessTestFoursquare() : void
- This function is used to test Foursquare API polygon-based business search functionality.
- getHotelDetails() : void
- Display comprehensive hotel details page for a specific hotel at an airport.
- imageInsertFoursquare() : void
- This function is used to download and store images from Foursquare API for airport services.
- insertPolygonData() : void
- This function is used to collect and store business data from Foursquare API using polygon search.
- insertSchedular() : void
- This function is used to execute scheduled data collection from Foursquare API for airport services.
- insertSFORadiusData() : void
- Process scheduled radius-based data collection from Foursquare API for airport services.
Methods
airportInfoByLocId()
This function is used to retrieve airport information from external GIS API using location ID.
public
airportInfoByLocId(string $locid) : stdClass
This method fetches comprehensive airport details from an external GIS service using the provided location ID. It initializes default values for all airport properties and updates them with actual data if available from the API response. The method handles cases where the API response might be empty or incomplete.
Parameters
- $locid : string
-
The location ID of the airport
Tags
Return values
stdClass —Airport information object with properties like locid, airport name, address, contact number, website, manager details, and geometry
businessTestFoursquare()
This function is used to test Foursquare API polygon-based business search functionality.
public
businessTestFoursquare(Request $request) : void
This method provides a testing interface for the Foursquare API polygon search feature. It accepts search query and polygon parameters from the request, constructs the API URL with comprehensive field specifications, makes the API request, and renders a test view with the search results. This is primarily used for development and testing purposes.
Parameters
- $request : Request
-
The HTTP request instance
Tags
Return values
void —Renders the test business details view and terminates execution
getHotelDetails()
Display comprehensive hotel details page for a specific hotel at an airport.
public
getHotelDetails(Request $request) : void
This method processes hotel detail requests by extracting airport and hotel information from URL segments. It validates airport existence, retrieves hotel details from the database, processes airport information from external APIs, gathers terminal data, photo details, and renders a complete hotel details page with header, content, and footer.
Parameters
- $request : Request
-
The HTTP request instance
Tags
Return values
void —Renders the hotel details page and terminates execution
imageInsertFoursquare()
This function is used to download and store images from Foursquare API for airport services.
public
imageInsertFoursquare(Request $request) : void
This method retrieves undownloaded images from the database for hotels and rental cars, downloads both original and thumbnail versions from Foursquare API, creates appropriate directory structures, and stores the images locally. It processes images in batches and updates the database to mark images as downloaded.
Parameters
- $request : Request
-
The HTTP request instance
Tags
Return values
void —Outputs success messages and terminates execution
insertPolygonData()
This function is used to collect and store business data from Foursquare API using polygon search.
public
insertPolygonData(Request $request) : void
This method performs a polygon-based search on the Foursquare API to retrieve businesses within a specific geographic area. It processes the API response, extracts business information including location, contact details, and features, and stores the data in the database for further processing.
Parameters
- $request : Request
-
The HTTP request instance
Tags
Return values
void —Outputs success message and terminates execution
insertSchedular()
This function is used to execute scheduled data collection from Foursquare API for airport services.
public
insertSchedular(Request $request) : void
This method processes scheduled airport service data collection tasks, including hotels, parking, and rental car services. It retrieves airport coordinates, makes API requests to Foursquare for nearby businesses, processes the responses, and stores the data in the appropriate database tables with image management.
Parameters
- $request : Request
-
The HTTP request instance
Tags
Return values
void —Outputs success message and terminates execution
insertSFORadiusData()
Process scheduled radius-based data collection from Foursquare API for airport services.
public
insertSFORadiusData(Request $request) : void
This method processes scheduled tasks for hotels and rental car services using radius-based searches on the Foursquare API. It retrieves airport coordinates, performs API searches within a 4km radius, processes comprehensive business data including categories, chains, features, hours, photos, reviews, and related places, then stores all information in appropriate database tables with proper relationships.
Parameters
- $request : Request
-
The HTTP request instance
Tags
Return values
void —Outputs success message and terminates execution