dev-master
9999999-dev https://github.com/sinevia/entityA streamlined EAV implementation for Laravel
proprietary
The Requires
- php ~5.6|~7.0
laravel entity eav sinevia
A streamlined EAV implementation for Laravel
Cool schemaless models for Laravel., (*1)
A streamlined entity-attribute-value (EAV) implementation for Laravel. This package is designed for quick plug and play "schemeless" prototyping. To achieve this the package uses only two database tables unlike the standard EAV (which uses at least three tables)., (*2)
composer require sinevia/laravel-entity
// 1. Create your model class class Note extends \Sinevia\Entities\Models\Entity { function getType() { return 'note'; } } // 2. Create new instance and add fields $note = new Note(); $note->save(); $note->setFieldValue('Title','Note title'); $note->setFieldValue('Text','Note text'); // 3. Create new instance and add fields $note = Note::find($noteId); echo $note->getFieldValue('Title'); echo $note->getFieldValue('Text'); // 4. Iterate throuhh all notes $note = Note::all(); foreach($notes as $note){ echo $note->getFieldValue('Title'); }
The following schema is used for the database., (*3)
Entity | |
---|---|
Id | String, UniqueId |
Status | String |
Type | String |
ParentId | String, UniqueId |
Sequence | Integer |
Name | String |
CreatedAt | DateTime |
DeletedAt | DateTime |
Udated At | DateTime |
Field | |
---|---|
Id | String, UniqueId |
EntityId | String, UniqueId |
Key | String |
Value | JSON Text (Long) |
CreatedAt | DateTime |
DeletedAt | DateTime |
UpdatedAt | DateTime |
A streamlined EAV implementation for Laravel
proprietary
laravel entity eav sinevia