1. Go to this page and download the library: Download unicodeveloper/laravel-ngsc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespaceApp\Http\Controllers;
useIlluminate\Http\Request;
useApp\Http\Requests;
useUnicodeveloper\Ngsc\Ngsc;
useApp\Http\Controllers\Controller;
classStateControllerextendsController{
protected $ngsc;
publicfunction__construct(Ngsc $ngsc){
$this->ngsc = $ngsc;
}
/**
* Get all states
* @return array
*/publicfunctiongetAllStates(){
return$this->ngsc->getAllStates();
}
}
/**
* Gets all the states in Nigeria
* @return array
*/
Ngsc::getAllStates()
/**
* Gets the details of just one state, e.g capital, lat, lng
* @param string state or state code
* @return array
*/
Ngsc::getOneState('lagos') OR Ngsc::getOneState('LA')
/**
* Gets the local government areas of just one state
* @param string state or state code
* @return array
*/
Ngsc::getLGAS('lagos') OR Ngsc::getLGAS('LA')
/**
* Gets the cities of just one state
* @param string state or state code
* @return array
*/
Ngsc::getCities('lagos') OR Ngsc::getCities('LA')