Skip to content

Commit

Permalink
Merge pull request #83 from EricBusch/patch-1
Browse files Browse the repository at this point in the history
Document retrieving models via nested attributes
  • Loading branch information
freekmurze authored Jul 13, 2021
2 parents 0ff3778 + 2c64e44 commit cfbab0c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ If you only want to search on a single custom attribute, you can use the modelSc
$yourModel->withExtraAttributes('name', 'value')->get();
```

If you only want to search on a nested custom attribute, you can use the modelScope like this

```php
// returns all models that have a schemaless nested attribute `han.side` set to `light`
$yourModel->withExtraAttributes('han->side', 'light')->get();
```

## Testing

First create a MySQL database named `laravel_schemaless_attributes`. After that you can run the tests with:
Expand Down

0 comments on commit cfbab0c

Please sign in to comment.