Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
medilies committed Jul 27, 2022
1 parent 0d5fd64 commit b1e1e83
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 69 deletions.
96 changes: 27 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/elaborate-code/laravel-algerian-provinces/run-tests?label=Tests&style=for-the-badge)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/elaborate-code/laravel-algerian-provinces/Fix%20PHP%20code%20style%20issues?label=Code%20Style&style=for-the-badge)

![banner](https://banners.beyondco.de/Algerian%20provinces.png?theme=dark&packageManager=composer+require&packageName=elaborate-code%2Flaravel-algerian-provinces&pattern=architect&style=style_1&description=Add+Algerian+provinces+table+to+Laravel&md=1&showWatermark=0&fontSize=100px&images=database)
![banner](https://banners.beyondco.de/Algerian%20provinces.png?theme=dark&packageManager=composer+require&packageName=elaborate-code%2Flaravel-algerian-provinces&pattern=architect&style=style_1&description=A+table+seeded+with+the+58+Algerian+provinces+for+Laravel+apps&md=1&showWatermark=0&fontSize=100px&images=database)

Algerian provinces migration and seeder for Laravel applications
[Algerian provinces](wilayas.md) migration and seeder for Laravel applications

## Installation

Expand Down Expand Up @@ -44,7 +44,7 @@ This is the contents of the published config file:
```php
return [
'table_name' => null, // defaults to wilayas
'column_name' => [
'columns_names' => [
'wilaya_fr_name' => null, // defaults to fr_name
'wilaya_ar_name' => null, // defaults to ar_name
],
Expand All @@ -55,7 +55,9 @@ That allows you to rename the `table` and `columns` names before running the mig

## Usage

After publishing and running the migrations, add the `ElaborateCode\AlgerianProvinces\Database\Seeders\WilayaSeeder` to the called seeders list or call it directly from the command line.
### Seeding

After publishing and running the migrations, add the `ElaborateCode\AlgerianProvinces\Database\Seeders\WilayaSeeder` to the called seeders list:

```php
<?php
Expand All @@ -66,11 +68,7 @@ use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/

public function run()
{
$this->call([
Expand All @@ -80,70 +78,30 @@ class DatabaseSeeder extends Seeder
}
```

Or call it directly from the command line:

```php
php .\artisan db:seed --class=ElaborateCode\AlgerianProvinces\Database\Seeders\WilayaSeeder
```
### Model

| Code | Province | Arabic name |
|--------|--------------------|------------------|
| 01 | Adrar | أدرار |
| 02 | Chlef | الشلف |
| 03 | Laghouat | الأغواط |
| 04 | Oum El Bouaghi | أم البواقي |
| 05 | Batna | باتنة |
| 06 | Béjaïa | بجاية |
| 07 | Biskra | بسكرة |
| 08 | Béchar | بشار |
| 09 | Blida | البليدة |
| 10 | Bouïra | البويرة |
| 11 | Tamanrasset | تمنراست |
| 12 | Tébessa | تبسة |
| 13 | Tlemcen | تلمسان |
| 14 | Tiaret | تيارت |
| 15 | Tizi Ouzou | تيزي وزو |
| 16 | Algiers | الجزائر |
| 17 | Djelfa | الجلفة |
| 18 | Jijel | جيجل |
| 19 | Sétif | سطيف |
| 20 | Saïda | سعيدة |
| 21 | Skikda | سكيكدة |
| 22 | Sidi Bel Abbès | سيدي بلعباس |
| 23 | Annaba | عنابة |
| 24 | Guelma | قالمة |
| 25 | Constantine | قسنطينة |
| 26 | Médéa | المدية |
| 27 | Mostaganem | مستغانم |
| 28 | M'Sila | المسيلة |
| 29 | Mascara | معسكر |
| 30 | Ouargla | ورقلة |
| 31 | Oran | وهران |
| 32 | El Bayadh | البيض |
| 33 | Illizi | اليزي |
| 34 | Bordj Bou Arréridj | برج بوعريريج |
| 35 | Boumerdès | بومرداس |
| 36 | El Tarf | الطارف |
| 37 | Tindouf | تندوف |
| 38 | Tissemsilt | تسمسيلت |
| 39 | El Oued | الوادي |
| 40 | Khenchela | خنشلة |
| 41 | Souk Ahras | سوق أهراس |
| 42 | Tipaza | تيبازة |
| 43 | Mila | ميلة |
| 44 | Aïn Defla | عين الدفلى |
| 45 | Naâma | النعامة |
| 46 | Aïn Témouchent | عين تموشنت |
| 47 | Ghardaïa | غرداية |
| 48 | Relizane | غليزان |
| 49 | El M'Ghair | المغير |
| 50 | El Menia | المنيعة |
| 51 | Ouled Djellal | أولاد جلال |
| 52 | Bordj Baji Mokhtar | برج باجي مختار |
| 53 | Béni Abbès | بني عباس |
| 54 | Timimoun | تيميمون |
| 55 | Touggourt | تقرت |
| 56 | Djanet | جانت |
| 57 | In Salah | عين صالح |
| 58 | In Guezzam | عين قزّام |
```php
namespace ElaborateCode\AlgerianProvinces\Models;

use Illuminate\Database\Eloquent\Model;

class Wilaya extends Model
{
protected $fillable = [];

public function __construct(array $attributes = [])
{
parent::__construct($attributes);

$this->table = config('algerian-provinces.table_name') ?? 'wilayas';
}
}
```

## Testing

Expand Down
64 changes: 64 additions & 0 deletions wilayas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Wilayas table

Here is what the migrated and seeded table will look like

| id | fr_name | ar_name |
| --- | ------------------ | -------------- |
| 1 | Adrar | أدرار |
| 2 | Chlef | الشلف |
| 3 | Laghouat | الأغواط |
| 4 | Oum El Bouaghi | أم البواقي |
| 5 | Batna | باتنة |
| 6 | Béjaïa | بجاية |
| 7 | Biskra | بسكرة |
| 8 | Béchar | بشار |
| 9 | Blida | البليدة |
| 10 | Bouïra | البويرة |
| 11 | Tamanrasset | تمنراست |
| 12 | Tébessa | تبسة |
| 13 | Tlemcen | تلمسان |
| 14 | Tiaret | تيارت |
| 15 | Tizi Ouzou | تيزي وزو |
| 16 | Algiers | الجزائر |
| 17 | Djelfa | الجلفة |
| 18 | Jijel | جيجل |
| 19 | Sétif | سطيف |
| 20 | Saïda | سعيدة |
| 21 | Skikda | سكيكدة |
| 22 | Sidi Bel Abbès | سيدي بلعباس |
| 23 | Annaba | عنابة |
| 24 | Guelma | قالمة |
| 25 | Constantine | قسنطينة |
| 26 | Médéa | المدية |
| 27 | Mostaganem | مستغانم |
| 28 | M'Sila | المسيلة |
| 29 | Mascara | معسكر |
| 30 | Ouargla | ورقلة |
| 31 | Oran | وهران |
| 32 | El Bayadh | البيض |
| 33 | Illizi | اليزي |
| 34 | Bordj Bou Arréridj | برج بوعريريج |
| 35 | Boumerdès | بومرداس |
| 36 | El Tarf | الطارف |
| 37 | Tindouf | تندوف |
| 38 | Tissemsilt | تسمسيلت |
| 39 | El Oued | الوادي |
| 40 | Khenchela | خنشلة |
| 41 | Souk Ahras | سوق أهراس |
| 42 | Tipaza | تيبازة |
| 43 | Mila | ميلة |
| 44 | Aïn Defla | عين الدفلى |
| 45 | Naâma | النعامة |
| 46 | Aïn Témouchent | عين تموشنت |
| 47 | Ghardaïa | غرداية |
| 48 | Relizane | غليزان |
| 49 | El M'Ghair | المغير |
| 50 | El Menia | المنيعة |
| 51 | Ouled Djellal | أولاد جلال |
| 52 | Bordj Baji Mokhtar | برج باجي مختار |
| 53 | Béni Abbès | بني عباس |
| 54 | Timimoun | تيميمون |
| 55 | Touggourt | تقرت |
| 56 | Djanet | جانت |
| 57 | In Salah | عين صالح |
| 58 | In Guezzam | عين قزّام |

0 comments on commit b1e1e83

Please sign in to comment.