From d152c668f8457446bd7a585f368661bc9775ea9d Mon Sep 17 00:00:00 2001 From: Sean Fraser Date: Sun, 28 Apr 2024 22:44:32 -0400 Subject: [PATCH] doc updates --- docs/source/intro.rst | 2 ++ docs/source/querying_meta.rst | 9 +-------- src/MetableInterface.php | 4 +++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/docs/source/intro.rst b/docs/source/intro.rst index ea3e1b7..846d597 100644 --- a/docs/source/intro.rst +++ b/docs/source/intro.rst @@ -49,6 +49,8 @@ Installation 5. Add the `Plank\\Metable\\Metable `_ trait to any eloquent model class that you want to be able to attach metadata to. +6. (Optional) Add the `Plank\\Metable\\MetableAttributes `_ trait to your model to enable applying meta using property accessors by prefixing the name with ``$this->meta_``. + Example Usage ---------------- diff --git a/docs/source/querying_meta.rst b/docs/source/querying_meta.rst index e3a6755..c5db7b7 100644 --- a/docs/source/querying_meta.rst +++ b/docs/source/querying_meta.rst @@ -140,11 +140,4 @@ To automatically exclude all records that do not have meta assigned to the sorte //equivalent to, but more efficient than $models = MyModel::whereHasMeta('score') - ->orderByMetaNumeric('score', 'desc')->get(); - - -Querying by Complex Data Types -------------------------------- - -By default, meta containing complex data types (e.g. objects and arrays) are not indexed and cannot be filtered or ordered with any of the above methods. If you need to query by these values, you can enable the ``metable.indexComplexDataTypes`` config option. This will cause a truncated version of the serialized value to be indexed. This can be useful for exact matches, but may not work predictably for other operations. Given the database overhead of indexing complex data types, it is recommended to only enable this feature if you need it. - + ->orderByMetaNumeric('score', 'desc')->get(); \ No newline at end of file diff --git a/src/MetableInterface.php b/src/MetableInterface.php index cf9dd5c..4e781f4 100644 --- a/src/MetableInterface.php +++ b/src/MetableInterface.php @@ -30,7 +30,9 @@ interface MetableInterface { public function meta(): MorphMany; - public function setMeta(string $key, mixed $value): void; + public function setMeta(string $key, mixed $value, bool $encrypted = false): void; + + public function setMetaEncrypted(string $key, mixed $value): void; public function setManyMeta(array $metaDictionary): void;