The angolan-geo Composer package is crafted to streamline the process of building models for Provincia (Provinces) and Municipio (Municipalities) in PHP applications, specifically tailored to the unique geographical structure of Angola. This package is a valuable asset for developers working on projects that demand accurate location-based information within the Angolan context.
josecaseiro/angolan-geo is a Laravel package for the angolan-geo composer package is crafted to streamline the process of building models for provincia (provinces) and municipio (municipalities) in php applications, specifically tailored to the unique geographical structure of angola. this package is a valuable asset for developers working on projects that demand accurate location-based information within the angolan context..
It currently has 10 GitHub stars and 42 downloads on Packagist (latest version 1.1.3).
Install it with composer require josecaseiro/angolan-geo.
Discover more Laravel packages by josecaseiro
or browse all Laravel packages to compare alternatives.
Last updated
AngolanGeo is a PHP Composer package that simplifies the process of creating and populating models for Provincia (Provinces) and Municipio (Municipalities) with accurate data of provinces and cities in Angola. This package is designed to seamlessly integrate with Laravel projects, providing an easy way to incorporate Angolan geographical information.
You can install the package via composer:
composer require josecaseiro/angolan-geo
After installing, you need to add the following line to the run method in your DatabaseSeeder file:
$this->call([ProvinciaSeeder::class]);
Your DatabaseSeeder under database\seeders should look like this:
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;
use Josecaseiro\AngolanGeo\Seeders\ProvinciaSeeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
$this->call([ProvinciaSeeder::class]);
}
}
Finally execute commands to import all data to your database:
php artisan migrate
then
php artisan db:seed
use Josecaseiro\AngolanGeo\Models\Provincia;
use Josecaseiro\AngolanGeo\Models\Municipio;
// Get all Provinces
$provincias = Provincia::all();
// Get a Province by name
$province = Provincia::where('name', 'Luanda')->first();
// Get all Municipios
$municipios = Municipio::all();
// Get Municipios by a Province
$luanda = Provincia::where('name', 'Luanda')->first();
$municipiosLuanda = $luanda->municipios;
// From a Municipio you can get its Province
$municipio = Municipio::first();
$prov = $municipio->provincia;
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.