Skip to content

GeneralUtility

App\Utilities\GeneralUtility

Convert List Data to Tree Structure List

php
ExtendUtility::collectionToTree($data, $primary, $parent, $children);
Parameter NameTypeRequiredDescription
dataArrayoptionalList data
primaryStringrequiredPrimary Key
parentStringrequiredParent Primary Key
childrenStringrequiredTree structure child Key

Calculate Distance Based on Latitude and Longitude

php
ExtendUtility::distanceOfLocation($langTag, $long, $lat, $userLong, $userLat, $mapId, $userMapId);
Parameter NameTypeRequiredDescription
langTagStringrequiredLanguage tag, get the distance unit km or mi for this language
longStringrequiredLongitude longitude
latStringrequiredLatitude latitude
userLongStringrequiredUser's longitude
userLatStringrequiredUser's latitude
mapIdStringoptionalLongitude and latitude from which map
userMapIdStringoptionalUser's longitude and latitude from which map

Released under the Apache-2.0 License