Skip to content

Commit 2bdb713

Browse files
committed
move method
1 parent 9c29794 commit 2bdb713

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ protected function attributes($attributes)
144144
);
145145
}
146146

147+
/**
148+
* Retrieve an accessor when it has been appended.
149+
*
150+
* @param string $attribute
151+
* @param mixed $value
152+
* @param mixed $default
153+
* @return \Illuminate\Http\Resources\MissingValue|mixed
154+
*/
155+
protected function whenAppended($attribute, $value = null, $default = null)
156+
{
157+
if ($this->resource->hasAppended($attribute)) {
158+
return func_num_args() >= 2 ? value($value) : $this->resource->$attribute;
159+
}
160+
161+
return func_num_args() === 3 ? value($default) : new MissingValue;
162+
}
163+
147164
/**
148165
* Retrieve a relationship if it has been loaded.
149166
*
@@ -209,23 +226,6 @@ protected function whenPivotLoadedAs($accessor, $table, $value, $default = null)
209226
);
210227
}
211228

212-
/**
213-
* Retrieve an accessor when it has been appended.
214-
*
215-
* @param string $attribute
216-
* @param mixed $value
217-
* @param mixed $default
218-
* @return \Illuminate\Http\Resources\MissingValue|mixed
219-
*/
220-
protected function whenAppended($attribute, $value = null, $default = null)
221-
{
222-
if ($this->resource->hasAppended($attribute)) {
223-
return func_num_args() >= 2 ? value($value) : $this->resource->$attribute;
224-
}
225-
226-
return func_num_args() === 3 ? value($default) : new MissingValue;
227-
}
228-
229229
/**
230230
* Transform the given value if it is present.
231231
*

0 commit comments

Comments
 (0)