Skip to content

Commit abc9cd4

Browse files
committed
document setAppends
1 parent 2c92e5c commit abc9cd4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

eloquent-collections.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ In addition, the `Illuminate\Database\Eloquent\Collection` class provides a supe
8181
[makeHidden](#method-makeHidden)
8282
[only](#method-only)
8383
[partition](#method-partition)
84+
[setAppends](#method-setAppends)
8485
[setVisible](#method-setVisible)
8586
[setHidden](#method-setHidden)
8687
[toQuery](#method-toquery)
@@ -251,6 +252,15 @@ dump($partition[0]::class); // Illuminate\Database\Eloquent\Collection
251252
dump($partition[1]::class); // Illuminate\Database\Eloquent\Collection
252253
```
253254

255+
<a name="method-setAppends"></a>
256+
#### `setAppends($attributes)` {.collection-method}
257+
258+
The `setAppends` method temporarily overrides all of the [appended attributes](/docs/{{version}}/eloquent-serialization#appending-values-to-json) on each model in the collection:
259+
260+
```php
261+
$users = $users->setAppends(['is_admin']);
262+
```
263+
254264
<a name="method-setVisible"></a>
255265
#### `setVisible($attributes)` {.collection-method}
256266

0 commit comments

Comments
 (0)