PHP code example of alive2212 / laravel-smart-meta

1. Go to this page and download the library: Download alive2212/laravel-smart-meta 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/ */

    

alive2212 / laravel-smart-meta example snippets


class User extends BaseAuthModel
{
    use SmartMeta;
}

$user = (new User())->find(1);
$user->putCacheMeta("1","I'm Strong man");

// 1
$user->addCacheMeta("1","I'm String man");

// 2
$user->pushCacheMeta(["1","I'm String man"]);


// 1 get all metas
$metaParams = $user->getCacheMetas();

// 2 get one of meta by key
$metaParams = $user->getCacheMeta("key","default");

// To delete all data
$user->deleteCacheMetas();

// TO delete one record
$user->deleteCacheMeta("key");