Last active
October 25, 2022 11:33
-
-
Save BrekiTomasson/70315b2492a5aaf5a74c5509d6381596 to your computer and use it in GitHub Desktop.
Laravel Trait to use in your Model classes to offer a $this->taggedCache() shortcut to your Cache
This has now been much improved and released as a package which can be found here: https://packagist.org/packages/brekitomasson/laravel-tagged-cache
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that you can also define the property
$cacheTagIdentifier
in your model to ensure that the cache tags it generates are distinct enough for that model. If$cacheTagIdentifier
is not defined, it uses the name of the database table for the given model by default, usingStr::singular()
to ensure that yourusers
table can result in auser:4
tag.