Code Monkey home page Code Monkey logo

provinces's Introduction

Laravel Package: Afghanistan Provinces & Districts

NOTE: The pacakge is not ready for production.

Latest Version on Packagist Total Downloads Repo Size Repo Size

Introduction:

The Laravel package "provinces" provides essential resources for managing Afghanistan's provinces and districts within your Laravel application. This package includes models, migrations, seeders, and factories to facilitate the integration of Afghanistan's administrative divisions into your project.

Requirements:

To use this package, ensure your Laravel application meets the following requirements:

  • PHP 8.1 or higher
  • Laravel 9 or higher

Installation:

You can effortlessly install the "afghanistan-provinces" package using Composer. Open your terminal and run the following command:

composer require open-afghanistan/afghanistan-provinces

Migrations:

After successful installation, you need to publish the migration files. Use the following Artisan command:

php artisan vendor:publish --tag=provinces-migrations

This command will generate a migration file that sets up the necessary tables for provinces and districts in your database.

Seeders:

The package includes a handy ProvincesSeeder that populates all 34 Afghanistan provinces along with their respective districts. You can call this seeder in your project's database seeder file as follows:

// DatabaseSeeder.php

use OpenAfghanistan\Provinces\Database\Seeders\ProvincesSeeder;

$this->call(ProvincesSeeder::class);

If you only wish to seed specific provinces, you can call their individual seeder classes:

// DatabaseSeeder.php

use OpenAfghanistan\Provinces\Database\Seeders\KabulProvinceSeeder;

$this->call(KabulProvinceSeeder::class);

Factories:

To facilitate testing, this package provides factories for both provinces and districts. You can create instances of these models in your tests with ease:

For provinces:

use OpenAfghanistan\Provinces\Models\Province;

Province::factory()->create();

For districts:

use OpenAfghanistan\Provinces\Models\District;

District::factory()->create();

Contribution Guide:

We welcome contributions to enhance this package. If you'd like to contribute by adding districts to any province, specific seeder files are available for each province to simplify the process. Please run the ./vendor/bin/pint command before you push any piece of code.

License:

The "provinces" package is open-source software distributed under the MIT License. You are free to use and modify it to suit your project's requirements.

Feel free to utilize this package to manage Afghanistan's administrative divisions effortlessly in your Laravel application.

provinces's People

Contributors

hoshmandaqil avatar

Stargazers

Elyas Afghan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.