Replies: 1 comment 1 reply
-
More information and sample codes are needed, but: If you are using your function like 'secret' => $this->when($isAdmin, 'secret-value'), Please change it to the closure like: 'secret' => $this->when($isAdmin, function () {
return 'secret-value';
}), Then you will ensure that |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
10.10
PHP Version
8.2
Database Driver & Version
MariaDB
Description
Hi
During the working process with Laravel Framework, especially with Laravel Eloquent API Resources, I found that ConditionallyLoadsAttributes's methods
when()
,mergeWhen()
,whenLoaded()
and otherswhen*()
methods work not as they are expected to: even if condition is false callback function will fire.Please, make logic works as expected
Steps To Reproduce
when()
orwhen<whatever>(
) methodswhen()
Beta Was this translation helpful? Give feedback.
All reactions