alive2212/laravel-smart-meta
Composer 安装命令:
composer require alive2212/laravel-smart-meta
包简介
this is meta data for any model that working with cache
README 文档
README
This is Smart Meta for any model to assign expirable date to each of records.
Structure
If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.
src/
tests/
Install
Via Composer
$ composer require alive2212/laravel-smart-meta
Usage
1- add trait to model
class User extends BaseAuthModel { use SmartMeta; }
2- to set meta to any model, should be done just following
$user = (new User())->find(1); $user->putCacheMeta("1","I'm Strong man");
3- Another methods to set metas are:
// 1 $user->addCacheMeta("1","I'm String man"); // 2 $user->pushCacheMeta(["1","I'm String man"]);
4- Get metas methods are:
// 1 get all metas $metaParams = $user->getCacheMetas(); // 2 get one of meta by key $metaParams = $user->getCacheMeta("key","default");
5- Delete
// To delete all data $user->deleteCacheMetas(); // TO delete one record $user->deleteCacheMeta("key");
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email alive2212@yahoo.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-09