PHP code example of vgplay / laravel-redis-model

1. Go to this page and download the library: Download vgplay/laravel-redis-model 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/ */

    

vgplay / laravel-redis-model example snippets


use Vgplay\LaravelRedisModel\Contracts\Cacheable;
use Vgplay\LaravelRedisModel\HasCache;

class Setting extends Model implements Cacheable
{
    use HasCache;

    ...
}

$cachedInstance = Setting::fromCache()->find($key);

public function scopeCacheWithRelation($query)
{
    return $query->with('relationship:id);
}