28 lines
		
	
	
		
			568 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			568 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
namespace Nodes\CounterCache\Traits;
 | 
						|
 | 
						|
/**
 | 
						|
 * Trait CounterCacheRestored
 | 
						|
 *
 | 
						|
 * @trait
 | 
						|
 * @package Nodes\CounterCache\Traits
 | 
						|
 */
 | 
						|
trait CounterCacheRestored
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * The "booting" of trait
 | 
						|
     *
 | 
						|
     * @author Morten Rugaard <moru@nodes.dk>
 | 
						|
     *
 | 
						|
     * @static
 | 
						|
     * @return void
 | 
						|
     */
 | 
						|
    public static function bootCounterCacheRestored()
 | 
						|
    {
 | 
						|
        if (method_exists(__CLASS__, 'restored')) {
 | 
						|
            static::restored(function ($model) {
 | 
						|
                app('Nodes\CounterCache\CounterCache')->count($model);
 | 
						|
            });
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |