PHP code example of gp10devhts / ug-village-locations
1. Go to this page and download the library: Download gp10devhts/ug-village-locations library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gp10devhts / ug-village-locations example snippets
use Gp10devhts\UgVillageLocations\Models\District;
use Gp10devhts\UgVillageLocations\Models\Village;
// Get all districts
$districts = District::all();
// Search by name
$kampala = District::search('Kampala')->first();
// Relationships
$counties = $kampala->counties;
$villages = Village::where('name', 'like', '%Kibuli%')->with('parish.subCounty.county.district')->get();
// Using the Facade for model resolution and helper methods
use Gp10devhts\UgVillageLocations\Facades\UgVillageLocations;
$districtModel = UgVillageLocations::districtModel();
$districts = UgVillageLocations::districts();
$counties = UgVillageLocations::counties($districtId);