Skip to content

Commit

Permalink
doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
frasmage committed Apr 29, 2024
1 parent 27fabbf commit d152c66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 2 additions & 0 deletions docs/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Installation

5. Add the `Plank\\Metable\\Metable <https://github.com/plank/laravel-metable/blob/master/src/Metable.php>`_ trait to any eloquent model class that you want to be able to attach metadata to.

6. (Optional) Add the `Plank\\Metable\\MetableAttributes <https://github.com/plank/laravel-metable/blob/master/src/MetableAttributes.php>`_ trait to your model to enable applying meta using property accessors by prefixing the name with ``$this->meta_``.

Example Usage
----------------

Expand Down
9 changes: 1 addition & 8 deletions docs/source/querying_meta.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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();
4 changes: 3 additions & 1 deletion src/MetableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d152c66

Please sign in to comment.