build status badge here code coverage badge here code quality badge here
This is a thoroughly-tested collection of components and traits with no external dependencies. It reduces boilerplate code while adhering to SOLID design principles. Its goal is to make working with Laravel sweeter than it already is.
Add caching behavior to any Laravel model.
use Illuminate\Database\Eloquent\Model;
use ITC\Laravel\Sugar\Models\Behaviors\Caching as ModelCachingBehavior;
class Car extends Model
{
use ModelCachingBehavior;
}
$car = Car::findOrFail(123);
// cache the model instance
$car->remember();
// retrieve the cached model instance
$car = Car::recall(123);
// uncache the model instance
$car->forget();
- PHP 7.0 or later
- Laravel 5.3 or later
This is a Composer package. Installation is trivial!
composer require itc/laravel-sugar
- API Documentation
- Reach us on our Slack channel
MIT