scubaclick / meta
Attach meta data to Eloquent models
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 3 451
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 2
Forks: 5
Open Issues: 0
Requires
- php: >=5.4.0
- illuminate/support: 4.1.*
- nesbot/carbon: 1.*
This package is auto-updated.
Last update: 2020-02-11 19:01:29 UTC
README
Trait and model to attach meta data to Eloquent models. Developed for ScubaClick and is considered stable now!
Stable Version
v1.0.1
General Installation
Install by adding the following to the require block in composer.json:
"scubaclick/meta": "1.*"
Then run composer update
.
Run Migrations
php artisan migrate --package="scubaclick/meta"
Usage
Add the trait to all models that you want to attach meta data to:
use Illuminate\Database\Eloquent\Model; class SomeModel extends Model { use \ScubaClick\Meta\MetaTrait; // model methods }
Then use like this:
$model = SomeModel::find(1); $model->getAllMeta(); $model->getMeta('some_key'); $model->updateMeta('some_key', 'New Value'); $model->deleteMeta('some_key'); $model->deleteAllMeta(); $model->addMeta('new_key', ['First Value']); $model->appendMeta('new_key', 'Second Value');
License
ScubaClick Meta is licenced under the MIT license.