<?php

namespace Laracasts\Matryoshka;

trait Cacheable
{
    /**
     * Calculate a unique cache key for the model instance.
     */
    public function getCacheKey()
    {
        return sprintf("%s/%s-%s", 
            get_class($this),
            $this->id,
            $this->updated_at->timestamp
        );
    }
}


<?php

namespace Laracasts\Matryoshka;

trait Cacheable
{
    /**
     * Calculate a unique cache key for the model instance.
     */
    public function getCacheKey()
    {
        return sprintf("%s/%s-%s",
            get_class($this),
            $this->getKey(),
            $this->updated_at->timestamp
        );
    }
}

Use more safer getKey() method instead of assumption that key is named id
Use more safer getKey() method instead of assumption that key is named id
