PHP code example of phumtech / laravel-cambodia-seeder
1. Go to this page and download the library: Download phumtech/laravel-cambodia-seeder 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/ */
phumtech / laravel-cambodia-seeder example snippets
use Phumtech\CambodiaSeeder\Models\Province;
// Get all provinces with their districts and communes
$provinces = Province::with('districts.communes')->get();
// Find a specific province by English name
$siemReap = Province::where('name_en', 'Siemreap')->first();
echo "Province: " . $siemReap->name_kh; // សៀមរាប
foreach ($siemReap->districts as $district) {
echo "District: " . $district->name_en;
}
bash
php artisan migrate
bash
php artisan cambodia:seed
bash
php artisan vendor:publish --tag=cambodia-data