Commit 81ae6b9a authored by Jens Segers's avatar Jens Segers

Update readme #744, fixes ##746

parent d6e625e7
...@@ -706,25 +706,7 @@ Like other relations, embedsMany assumes the local key of the relationship based ...@@ -706,25 +706,7 @@ Like other relations, embedsMany assumes the local key of the relationship based
return $this->embedsMany('Book', 'local_key'); return $this->embedsMany('Book', 'local_key');
``` ```
Embedded relations will return a Collection of embedded items instead of a query builder. To allow a more query-like behavior, a modified version of the Collection class is used, with support for the following **additional** operations: Embedded relations will return a Collection of embedded items instead of a query builder. Check out the available operations here: https://laravel.com/docs/master/collections
- where($key, $operator, $value)
- whereIn($key, $values) and whereNotIn($key, $values)
- whereBetween($key, $values) and whereNotBetween($key, $values)
- whereNull($key) and whereNotNull($key)
- orderBy($key, $direction)
- oldest() and latest()
- limit($value)
- offset($value)
- skip($value)
This allows you to execute simple queries on the collection results:
```php
$books = $user->books()->where('rating', '>', 5)->orderBy('title')->get();
```
**Note:** Because embedded models are not stored in a separate collection, you can not query all of embedded models. You will always have to access them through the parent model.
### EmbedsOne Relations ### EmbedsOne Relations
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment