Skip to content

dennisoderwald/scubaclick-meta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScubaClick Meta

Trait and model to attach meta data to Eloquent models. Still being developed for ScubaClick, so handle with care for now!

Stable Version

v1.0

General Installation

Install by adding the following to the require block in composer.json:

"scubaclick/meta": "dev-master"

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.

About

Add meta data to Eloquent models

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages