counter-cache/src/Traits/CounterCacheUpdated.php

26 lines
489 B
PHP
Raw Normal View History

2015-12-06 16:02:48 +00:00
<?php
namespace Nodes\CounterCache\Traits;
/**
* Trait CounterCacheUpdated
*
* @trait
* @package Nodes\CounterCache\Traits
*/
trait CounterCacheUpdated
{
/**
* The "booting" of trait
*
* @author Morten Rugaard <moru@nodes.dk>
*
* @static
* @return void
*/
public static function bootCounterCacheUpdated()
{
static::updated(function($model) {
app('Nodes\CounterCache\CounterCache')->count($model);
});
}
}