PHP code example of tonning / metabox
1. Go to this page and download the library: Download tonning/metabox library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tonning / metabox example snippets
'providers' => [
Tonning\Metabox\MetaboxServiceProvider::class
];
'aliases' => [
'Metabox' => Tonning\Metabox\MetaboxFacade::class
];
/**
* 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);
}