Airport Guide Documentation

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
uses
getInfoByCurl()

To fetch airport data from external GIS API

throws
Exception

When the external API request fails

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
uses
Client

To make HTTP requests to the Foursquare API

uses
json_decode()

To decode the API response

uses
view()

For rendering the test business details template

see
Request::get()

To retrieve search and polygon parameters

throws
GuzzleException

When the Foursquare API request fails

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
see
Request::segments()

To extract airport code and hotel slug from URL

uses
Airports19k

Model to query airport data by LOCID or ICAO identifier

uses
getAirportIdByCiasIdentifier()

To retrieve airport information

uses
airportInfoByLocId()

To fetch airport details from external API

uses
AirportsAirportflyer

Model to retrieve airport title information

uses
GlobalSetting

Model to retrieve global settings

uses
TerminalDetails

Model to retrieve terminal information

uses
getCountAllData()

To retrieve count information for various services

uses
AirportImages

Model to retrieve airport images

uses
getContentUrlImg()

To generate image URLs

uses
HotelsAirportFlyer

Model to retrieve hotel details

uses
view()

For rendering the hotel details template

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
uses
DB

For database operations to retrieve and update image data

uses
Http

To make HTTP requests to retrieve images from Foursquare API

uses
File

To manage file operations for image storage

uses
public_path()

To determine the base path for image storage

uses
basename()

To extract filename from URL

uses
strtolower()

To convert airport codes to lowercase for directory names

uses
ensureDirectoryExists()

To create directories if they don't exist

uses
put()

To save images to the specified path

throws
Exception

When image download fails or file operations fail

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
uses
Client

To make HTTP requests to the Foursquare API

uses
DB

For database operations to store collected data

throws
GuzzleException

When the Foursquare API request fails

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
uses
Client

To make HTTP requests to the Foursquare API

uses
FSSchedulerMaster

Model to retrieve scheduled tasks

uses
DB

For database operations to store collected data

throws
GuzzleException

When the Foursquare API request fails

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
uses
Client

To make HTTP requests to the Foursquare API

uses
FSSchedulerMaster

Model to retrieve and update scheduled tasks

uses
DB

For database operations to store collected data

throws
GuzzleException

When the Foursquare API request fails

Return values
void

Outputs success message and terminates execution


        
On this page

Search results