PHP code example of khophim8k / laravel-caching-model
1. Go to this page and download the library: Download khophim8k/laravel-caching-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/ */
khophim8k / laravel-caching-model example snippets
use Khophim8k\CachingModel\Contracts\Cacheable;
use Khophim8k\CachingModel\HasCache;
class Setting extends Model implements Cacheable
{
use HasCache;
...
}
$cachedInstance = Setting::fromCache()->find($key);
public function scopeCacheWithRelation($query)
{
return $query->with('relationship:id);
}