Download the PHP package davidwesdijk/laravel-polymorphic-eav without Composer
On this page you can find all versions of the php package davidwesdijk/laravel-polymorphic-eav. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download davidwesdijk/laravel-polymorphic-eav
More information about davidwesdijk/laravel-polymorphic-eav
Files in davidwesdijk/laravel-polymorphic-eav
Package laravel-polymorphic-eav
Short Description Integrate the entity-attribute-value model with polymorphic Eloquent-relations in your Laravel application.
License MIT
Homepage https://github.com/davidwesdijk/laravel-polymorphic-eav
Informations about the package laravel-polymorphic-eav
Polymorphic EAV-model integration
Integrate the entity-attribute-value model with polymorphic Eloquent-relations in your Laravel application.
Installation
You can install the package via composer:
Usage
Preparing your models
In order to implement the Entity-Attribute-Value-model to your Eloquent models, the only required action is to add the
HasEntityAttributeValues
Trait. That's all action required to use the full features this package brings.
Assigning attributes
Attributes are, when the Trait is added, accessable and assignable by the props
accessor on your Eloquent Model.
Just set its value!
Accessing attributes
The assigned attributes are simply accessible by defining the group and the attribute in the props
accessor like
the following example. The concept is that all required properties must be accessible, without throwing exceptions, to
keep you code clean, readable and maintainable.
Other functionality
If you'd like e.g. remove a property you can either set it's value to null, or you can simply unset the value. The database entry will be removed.
Serializing
You might run into a situation where you have to have all assigned properties available in an array or json. This
package respects the Arrayable
and Jsonable
interfaces.
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- David Wesdijk
- All Contributors
License
The MIT License (MIT). Please see License File for more information.