Laravel Eloqeunt model auto caching.
Library | Version |
---|---|
Laravel | 5.5 |
composer require tarkhov/eloquent-cache
Start using caching features by inheriting CacheModel
class.
<?php
namespace App;
use EloquentCache\Database\Eloquent\CacheModel;
class Post extends CacheModel
{
protected $fillable = [
'category_id',
'title',
'description',
];
public function category()
{
return $this->belongsTo('App\Category', 'category_id');
}
}
<?php
namespace App;
use EloquentCache\Database\Eloquent\CacheModel;
class Category extends CacheModel
{
protected $cacheTags = ['category'];
protected $fillable = [
'title',
'description',
];
}
Alexander Tarkhov
This project is licensed under the MIT License - see the LICENSE
file for details.