diff --git a/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php b/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php index 16e026986484..b0b33212c36f 100644 --- a/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php +++ b/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php @@ -256,7 +256,7 @@ protected function whenAppended($attribute, $value = null, $default = null) * @param mixed $default * @return \Illuminate\Http\Resources\MissingValue|mixed */ - protected function whenLoaded($relationship, $value = null, $default = null) + protected function whenLoaded($relationship, $value = '__UNSET__', $default = null) { if (func_num_args() < 3) { $default = new MissingValue; @@ -276,7 +276,7 @@ protected function whenLoaded($relationship, $value = null, $default = null) return; } - if ($value === null) { + if ($value === '__UNSET__') { $value = value(...); } @@ -291,7 +291,7 @@ protected function whenLoaded($relationship, $value = null, $default = null) * @param mixed $default * @return \Illuminate\Http\Resources\MissingValue|mixed */ - public function whenCounted($relationship, $value = null, $default = null) + public function whenCounted($relationship, $value = '__UNSET__', $default = null) { if (func_num_args() < 3) { $default = new MissingValue; @@ -311,7 +311,7 @@ public function whenCounted($relationship, $value = null, $default = null) return; } - if ($value === null) { + if ($value === '__UNSET__') { $value = value(...); } @@ -328,7 +328,7 @@ public function whenCounted($relationship, $value = null, $default = null) * @param mixed $default * @return \Illuminate\Http\Resources\MissingValue|mixed */ - public function whenAggregated($relationship, $column, $aggregate, $value = null, $default = null) + public function whenAggregated($relationship, $column, $aggregate, $value = '__UNSET__', $default = null) { if (func_num_args() < 5) { $default = new MissingValue; @@ -348,7 +348,7 @@ public function whenAggregated($relationship, $column, $aggregate, $value = null return; } - if ($value === null) { + if ($value === '__UNSET__') { $value = value(...); }