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