tonning / metabox
此包已被废弃,不再维护。未建议替代包。
为AdminLTE管理面板创建元框
0.1.4
2015-07-10 19:03 UTC
Requires
- laravelcollective/html: ^5.1
This package is not auto-updated.
Last update: 2022-02-01 12:48:59 UTC
README
安装
首先,通过Composer引入此包。
"require": { "tonning/metabox": "~0.1" }
然后,如果使用Laravel 5.1,在app/config/app.php
中包含服务提供者。
'providers' => [ Tonning\Metabox\MetaboxServiceProvider::class ];
为了方便,在此文件的底部添加一个外观别名
'aliases' => [ 'Metabox' => Tonning\Metabox\MetaboxFacade::class ];
在使用元框的Eloquent模型上添加
/** * 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); }