public static function bootHasPermalink()
    {
        if (!property_exists(get_called_class(), 'permalinkable')) {
            throw new Exception(sprintf(
                'You must define a $permalinkable property in %s to use the HasPermalink trait.', get_called_class()
            ));
        }

        static::saving(function (Model $model) {
            $model->generatePermalinkOnSave();
        });
    }