jn-devops / products
Homeful Products Package
                                    Fund package maintenance!
                                                                            
                                                                                                                                        Homeful
                                                                                    
                                                                
Installs: 3 023
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/jn-devops/products
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- jn-devops/common: ^1.1
- spatie/laravel-data: ^4.8
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- spatie/laravel-ray: ^1.35
- dev-main
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.0
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-7
- dev-dependabot/github_actions/actions/checkout-5
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-6
This package is auto-updated.
Last update: 2025-10-13 14:41:06 UTC
README
This package is part of the Homeful ecosystem and represents a robust Eloquent-based product model for real estate or housing-related systems. It supports a wide range of property and product-related fields and implements the ProductInterface.
๐ฆ Product Model Overview
The Product model captures both core product identity and extended metadata such as property location, pricing, appraisal, and requirements using the SchemalessAttributes via the meta field.
โ Implements:
- ProductInterface
- Supports price casting using Whitecube\Price
- Configurable with Laravel's environment and configuration system
๐งฉ Traits Used
HasAdditionalAttributes
This trait defines metadata-backed accessors/mutators using the SchemalessAttributes package. Key functionalities include:
๐ Property Metadata Fields
- Basic Fields: market_segment,location,destinations,directions,amenities,facade_url
- Property Info: project_location,project_code,property_name,phase,block,lot
- Dimensions: lot_area,floor_area,project_address
- Structure: property_type,unit_type,house_type
- Financials:
- price
- appraised_value
- percent_down_payment
- down_payment_term
- percent_miscellaneous_fees
- processing_fee
 
- Loan-Related:
- balance_payment_interest_rate
- balance_payment_term
- mortgage_redemption_insurance_fee
- income_requirement_multiplier
- percent_gross_monthly_income
 
- Eligibility:
- max_age
- maximum_paying_age
 
- Status & Media:
- status_code
- key_location
- digital_assets
- phased_out
 
Each field is encapsulated via custom getXXXAttribute() and setXXXAttribute() accessors/mutators, backed by JSON metadata.
๐๏ธ Model Details
Key Properties
| Property | Type | Source | 
|---|---|---|
| sku | string | Eloquent | 
| name | string | Eloquent | 
| brand | string | Eloquent | 
| category | string | Eloquent | 
| description | string | Eloquent | 
| price | Price | castsviaPriceCast | 
| appraised_value | Price | meta | 
| percent_down_payment | float | meta | 
| down_payment_term | int | meta | 
| percent_miscellaneous_fees | float | meta | 
| processing_fee | float | metaor fallback | 
| phased_out | bool | meta | 
๐ฅ Config Defaults (config/products.php)
return [ 'default' => [ 'processing_fee' => 10000, 'percent_dp' => 0.10, // 10% 'dp_term' => 12, // 12 months 'percent_mf' => 0.085, // 8.5% ], ];
๐งช Tests
Functional Coverage:
- Asserts all core and meta attributes are working as expected
- Verifies casting and type correctness (e.g., Price, float, int, string)
- Confirms that ProductData::fromModel()transformation works
- Tests updateOrCreate()and interface compliance
expect($product->getAppraisedValue()->equals($product->appraised_value))->toBeTrue(); expect($product->getPercentDownPayment())->toBe($product->percent_down_payment);
๐งฌ Data Transformation
ProductData
The ProductData class maps the Product model into a normalized, transport-ready DTO using Spatie Laravel Data:
$data = ProductData::fromModel($product);
Provides direct mapping to all relevant fields like:
- sku,- name,- brand,- description, etc.
- Financial metrics and interest/multiplier values
- Metadata-rich project and unit identifiers
๐ Conclusion
This package bridges the static nature of database tables and the flexibility needed for real estate product customization. By leveraging SchemalessAttributes, it ensures adaptability without schema bloat.
Behold, a new you awaits โ in housing, and in code. ๐กโจ