diff --git a/eloquent-collections.md b/eloquent-collections.md index 21d08dae2f..978f5499ce 100644 --- a/eloquent-collections.md +++ b/eloquent-collections.md @@ -79,6 +79,8 @@ In addition, the `Illuminate\Database\Eloquent\Collection` class provides a supe [modelKeys](#method-modelKeys) [makeVisible](#method-makeVisible) [makeHidden](#method-makeHidden) +[mergeVisible](#method-mergeVisible) +[mergeHidden](#method-mergeHidden) [only](#method-only) [partition](#method-partition) [setAppends](#method-setAppends) @@ -231,6 +233,24 @@ The `makeHidden` method [hides attributes](/docs/{{version}}/eloquent-serializat $users = $users->makeHidden(['address', 'phone_number']); ``` + +#### `mergeVisible($attributes)` {.collection-method} + +The `mergeVisible` method [makes attributes visible](/docs/{{version}}/eloquent-serialization#hiding-attributes-from-json) that typically merges these attributes to the `$visible` array on each model in the collection: + +```php +$users = $users->mergeVisible(['middle_name']); +``` + + +#### `mergeHidden($attributes)` {.collection-method} + +The `mergeHidden` method [hides attributes](/docs/{{version}}/eloquent-serialization#hiding-attributes-from-json) that typically merges these attributes to the `$hidden` array on each model in the collection: + +```php +$users = $users->mergeHidden(['last_login_at']); +``` + #### `only($keys)` {.collection-method}