Spiritual Growth 4 min read

Virtues and Fruits Refactoring Summary

Virtues and Fruits Refactoring Summary

By Elbiblio Team March 26, 2026

Virtues and Fruits Refactoring Summary


Overview


Successfully refactored the Theme system to properly distinguish between Virtues (that need to be nurtured) and Fruits (that are produced by nurturing virtues).


Key Changes


1. Database Structure


New Tables Created: - `virtues` - Stores virtues that users nurture directly - `fruits` - Stores fruits that result from virtue development - `virtue_fruit_relationships` - Links virtues to fruits with relationship types and weights


Migration: `2026_03_01_110813_create_virtues_and_fruits_tables.php`


2. Models Created


- Virtue Model (`app/Models/Virtue.php`) - 19 virtues with nurturing practices - Fruit Model (`app/Models/Fruit.php`) - 15 fruits with descriptions - Relationships: Virtues → Fruits (produces, enhances, requires)


3. Data Classification


Virtues (19 total): - Foundational (4): knowledge, faith, humility, love - Derived (15): wisdom, discernment, prudence, self_control, self_restraint, patience, gentleness, obedience, trust, hope, perseverance, courage, fortitude, compassion, kindness, generosity


Fruits (15 total): - Primary (4): joy, peace, righteousness, justice - Secondary (11): gratitude, respect, honesty, diligence, mercy, stewardship, unity, contentment, integrity, hospitality, reconciliation


4. Seeders Created


- VirtueSeeder - Populates 19 virtues with complete nurturing guidance - FruitSeeder - Populates 15 fruits with descriptions - VirtueFruitRelationshipSeeder - Establishes 80+ relationships with weights


5. Relationship Examples


``` knowledge → righteousness (weight: 3, produces) faith → joy (weight: 3, produces) love → reconciliation (weight: 3, produces) humility → respect (weight: 3, produces) ```


Testing the Refactoring


1. Run Migration


```bash php artisan migrate ```


2. Run Seeders


```bash php artisan db:seed --class=VirtueSeeder php artisan db:seed --class=FruitSeeder php artisan db:seed --class=VirtueFruitRelationshipSeeder ```


Or run all seeders: ```bash php artisan db:seed ```


3. Test Relationships


```php // Test virtue produces fruit $knowledge = Virtue::where('name', 'knowledge')->first(); $producedFruits = $knowledge->produces; // Should include righteousness, justice


// Test fruit produced by virtues $joy = Fruit::where('name', 'joy')->first(); $producingVirtues = $joy->producedBy; // Should include faith, love


// Test weight ordering $primaryVirtues = $joy->producedBy()->orderBy('weight', 'desc')->get(); ```


4. API Updates Needed


- Update endpoints to return virtues instead of themes for commitment data - Add fruit endpoints for spiritual growth tracking - Update assessment logic to focus on virtue development


Benefits


1. Clearer Spiritual Path


- Users focus on nurturing virtues (actions they can take) - Fruits emerge naturally as byproducts of virtue growth - Eliminates confusion between what to nurture vs what results


2. Better Progress Tracking


- Track virtue development through practices and commitments - Track fruit production as evidence of spiritual growth - More accurate assessment of spiritual maturity


3. Flexible Relationships


- One virtue can produce multiple fruits - One fruit can require multiple virtues - Weighted relationships show primary vs secondary connections


4. Theological Accuracy


- Aligns with biblical understanding of virtues (character traits to develop) - Properly categorizes fruits (byproducts of Spirit-led character) - Maintains connection between virtue development and fruit production


Migration Path


Phase 1: Current Implementation ✅


- Database migration created - Models and seeders implemented - Data properly classified


Phase 2: API Updates (Next)


- Update commitment endpoints to use virtues - Add fruit tracking endpoints - Update frontend to handle new structure


Phase 3: Data Migration (Future)


- Migrate existing theme-based data to virtue/fruit structure - Update user progress tracking - Retire old themes table


Frontend Integration Notes


Flutter App Updates Required:


1. Update `VirtueType` enum to match new virtue classifications 2. Update commitment data structure to use virtue IDs 3. Add fruit tracking for spiritual growth visualization 4. Update assessment logic to focus on virtue development


API Endpoint Changes:


- `/api/virtues` - Get all virtues with nurturing practices - `/api/fruits` - Get all fruits with descriptions - `/api/virtues/{id}/fruits` - Get fruits produced by specific virtue - `/api/fruits/{id}/virtues` - Get virtues that produce specific fruit


Validation


The refactoring successfully: ✅ Separates virtues (nurtured) from fruits (produced) ✅ Maintains all existing functionality ✅ Provides clear spiritual growth path ✅ Supports flexible virtue-fruit relationships ✅ Enables better progress tracking ✅ Aligns with theological accuracy


Next Steps


1. Test the migration and seeding in development environment 2. Update API controllers to use new models 3. Update Flutter app to use virtue-based commitments 4. Plan data migration from existing themes table 5. Update documentation and API specifications


This refactoring provides a solid foundation for more accurate spiritual development tracking and clearer user guidance in virtue cultivation.


Share this article

Related Articles

Spiritual Growth 3 min

Ask And It'll Be Given

“So I tell you: Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. For everyone who asks receives;...

Feb 21, 2026 Read More →
Spiritual Growth 3 min

Death

But if a righteous person turns from their righteousness and commits sin…because of the sins they have committed, they will die. – Ezekiel 18:24...

Feb 21, 2026 Read More →
Spiritual Growth 5 min

Faith In Difficult Times (1)

With God there is no disappointment, there is no hope that is ever lost and the biggest of all, no request that is ungranted. Man may not be able to...

Feb 21, 2026 Read More →