alive2212/laravel-smart-meta

this is meta data for any model that working with cache

Downloads

15

Stars

2

Version

v1.0.1

LaravelSmartMeta

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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 [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Alive2212

Author

Alive2212