tonning/metabox

This package is abandoned and no longer maintained. No replacement package was suggested.

Create metaboxes for AdminLTE admin panel

0.1.4 2015-07-10 19:03 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:48:59 UTC


README

Installation

First, pull in the package through Composer.

"require": {
    "tonning/metabox": "~0.1"
}

And then, if using Laravel 5.1, include the service provider within app/config/app.php.

'providers' => [
    Tonning\Metabox\MetaboxServiceProvider::class
];

And, for convenience, add a facade alias to this same file at the bottom:

'aliases' => [
    'Metabox' => Tonning\Metabox\MetaboxFacade::class
];

On Eloquent models that uses metaboxes add

/**
 * Serialize the meta data on persist
 *
 * @param $meta
 */
public function setMetaAttribute($meta)
{
    $this->attributes['meta'] = serialize($meta);
}

/**
 * Unserialize the meta data on retrival
 *
 * @param $meta
 * @return mixed
 */
public function getMetaAttribute($meta)
{
    return unserialize($meta);
}