Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 469f6b3

Browse files
document merges
1 parent a9dea14 commit 469f6b3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎eloquent-serialization.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,20 @@ class User extends Model
131131
<a name="temporarily-modifying-attribute-visibility"></a>
132132
#### Temporarily Modifying Attribute Visibility
133133

134-
If you would like to make some typically hidden attributes visible on a given model instance, you may use the `makeVisible` method. The `makeVisible` method returns the model instance:
134+
If you would like to make some typically hidden attributes visible on a given model instance, you may use the `makeVisible` or `mergeVisible` methods. The `makeVisible` method returns the model instance:
135135

136136
```php
137137
return $user->makeVisible('attribute')->toArray();
138+
139+
return $user->mergeVisible(['name', 'email'])->toArray();
138140
```
139141

140-
Likewise, if you would like to hide some attributes that are typically visible, you may use the `makeHidden` method.
142+
Likewise, if you would like to hide some attributes that are typically visible, you may use the `makeHidden` or `mergeHidden` methods:
141143

142144
```php
143145
return $user->makeHidden('attribute')->toArray();
146+
147+
return $user->mergeHidden(['name', 'email'])->toArray();
144148
```
145149

146150
If you wish to temporarily override all of the visible or hidden attributes, you may use the `setVisible` and `setHidden` methods respectively:
@@ -203,11 +207,13 @@ Once the attribute has been added to the `appends` list, it will be included in
203207
<a name="appending-at-run-time"></a>
204208
#### Appending at Run Time
205209

206-
At runtime, you may instruct a model instance to append additional attributes using the `append` method. Or, you may use the `setAppends` method to override the entire array of appended properties for a given model instance:
210+
At runtime, you may instruct a model instance to append additional attributes using the `append` or `mergeAppends` methods. Or, you may use the `setAppends` method to override the entire array of appended properties for a given model instance:
207211

208212
```php
209213
return $user->append('is_admin')->toArray();
210214

215+
return $user->mergeAppends(['is_admin', 'status'])->toArray();
216+
211217
return $user->setAppends(['is_admin'])->toArray();
212218
```
213219

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /