protected static function boot()
{
$class = get_called_class();
static::$mutatorCache[$class] = array();
// Here we will extract all of the mutated attributes so that we can quickly
// spin through them after we export models to their array form, which we
// need to be fast. This will let us always know the attributes mutate.
foreach (get_class_methods($class) as $method) {
if (preg_match('/^get(.+)Attribute$/', $method, $matches)) {
if (static::$snakeAttributes) {
$matches[1] = snake_case($matches[1]);
}
static::$mutatorCache[$class][] = lcfirst($matches[1]);
}
}
}