inisiatif/model-shared
Kumpulan model Eloquent bersama untuk Inisiatif Zakat Indonesia: pekerjaan, tingkat pendidikan, wilayah (negara–provinsi–desa), dan status perkawinan. Mendukung relasi dinamis Branch dan Employee pada model Donor via resolveRelationUsing.
Pros:
Outflows, Donation).Region models but extend Donor locally).Donor::branch()) via resolveRelationUsing, enabling integration with custom branch/employee models without schema changes.Cons:
Province, District). Not suitable for global applications.Donor or Outflows are opinionated (e.g., fields like donor_phone_id, email). Customization may require forking or overriding.Donor may require significant overrides (e.g., adding corporate-specific fields).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Laravel Version Mismatch | High | Test compatibility with Laravel 10+; patch or fork if needed. |
| Indonesia-Specific Assumptions | High | Validate if geographic models meet all regional requirements (e.g., village updates). |
| Dynamic Relations Overhead | Medium | Document custom resolveRelationUsing implementations in the service provider. |
| Migration Conflicts | Medium | Run migrations in a staging environment first; handle schema conflicts manually. |
| No Active Maintenance | High | Plan for internal maintenance or fork the repo if critical bugs arise. |
| Performance Overhead | Low | Models are lightweight; monitor query performance for deep geographic hierarchies. |
Domain Scope:
Maintenance:
Integration Depth:
Region, Donor, Outflows), or only a subset?Data Ownership:
Long-Term Strategy:
Best For:
Poor Fit:
| Step | Action | Tools/Notes |
|---|---|---|
| 1 | Assess Compatibility | Test with Laravel 10+; check for breaking changes (e.g., resolveRelationUsing in newer Eloquent). |
| 2 | Selective Adoption | Choose models to integrate (e.g., Region, Donor, Outflows). Skip or override others. |
| 3 | Service Provider Setup | Add dynamic relations (e.g., Donor::branch()) in AppServiceProvider::boot(). |
| 4 | Migration Strategy | Run package migrations last to avoid conflicts; handle schema overlaps manually. |
| 5 | Customization Layer | Create abstract classes or traits to extend models (e.g., CustomDonor extends \Inisiatif\ModelShared\Models\Donor). |
| 6 | Testing | Validate: |
donor->branch).resolveRelationUsing implementations.resolveRelationUsing).composer.json).laravel-query-builder (updated in v2.6.0).composer.json for version mismatches.Phase 1: Core Models
Region, Province, etc.) and donor models.Donor::branch()).Phase 2: Financial Workflows
Donation, Outflows, and related models.Phase 3: Customization
Donor or Partner models for project-specific needs.Phase 4: Performance Optimization
How can I help you explore Laravel packages today?