- How do I install Laravel ID Provinces for my Laravel project?
- Run `composer require ferdirn/laravel-id-provinces:dev-master`, register the `ProvincesServiceProvider` and `Provinces` facade in `config/app.php`, then generate the migration with `php artisan provinces:migration` and run `php artisan migrate --seed` to populate the `provinces` table.
- Does this package work with Laravel 8, 9, or 10?
- The package is untested for Laravel 8+ and may require adjustments. Check compatibility by reviewing the `composer.json` constraints or test in a staging environment before production use. The README suggests it was built for Laravel 5.x/6.x.
- Can I customize the table name or add extra fields like postal codes?
- Yes, publish the config with `php artisan config:publish ferdirn/laravel-id-provinces` to modify the table name. Adding extra fields requires manual migration changes or extending the `Provinces` model, as the package doesn’t support dynamic schema extensions.
- Is the province data up-to-date? How often is it refreshed?
- The dataset is static and lacks versioning or API sync. Check the [GitHub repo](https://github.com/ferdirn/laravel-id-provinces) for updates, but administrative changes in Indonesia may not be reflected. Consider forking to add manual update triggers or API integration.
- Will this package support cities or districts in the future?
- Currently, it’s limited to provinces only. For cities/districts, you’d need to extend the model or use a separate package like `ferdirn/laravel-id-countries` for broader geographic coverage. The package’s scope is explicitly provincial data.
- How do I validate a form field against Indonesian provinces in Laravel?
- Use Laravel’s validation rules with the seeded `provinces` table. Example: `'province' => 'required|exists:provinces,name'`. The package provides an Eloquent model (`Provinces`) for easy querying, like `Provinces::where('name', 'DKI Jakarta')->exists()`.
- Does this package include province names in Indonesian (Bahasa) or just English?
- The package provides province names in English by default. For Indonesian (Bahasa) names, you’d need to manually extend the dataset or modify the seeder. Check the raw data in the migration file for potential localization opportunities.
- What if I already have a `provinces` table? Can I merge the data?
- No, the package generates a fresh migration and seeder. To merge data, export your existing table, drop it, run the package’s migration, then manually reinsert custom data. Alternatively, fork the package to support incremental updates.
- Are there any performance concerns with large-scale queries (e.g., filtering by area)?
- The package is lightweight and uses standard Eloquent queries, so performance should be fine for typical use cases. For large datasets, add indexes to the `provinces` table (e.g., `area` or `name`) in your migration. Test with `Provinces::orderBy('area', 'desc')->get()` in your environment.
- What alternatives exist for Indonesian geographic data in Laravel?
- For broader coverage, consider `ferdirn/laravel-id-countries` (also by the same author) or third-party APIs like [Indonesia’s official API](https://developer.bigdata.id/) for dynamic updates. For cities/districts, check packages like `spatie/laravel-geocoder` or build a custom solution with OpenStreetMap data.