Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Use Fluent instead of array on Rule::when() #38397

Merged
merged 1 commit into from
Aug 16, 2021

Conversation

crynobone
Copy link
Member

Consistent with Illuminate\Validation\Validator::sometimes()

public function sometimes($attribute, $rules, callable $callback)
{
$payload = new Fluent($this->getData());
if ($callback($payload)) {
foreach ((array) $attribute as $key) {
$this->addRules([$key => $rules]);
}
}
return $this;
}

Signed-off-by: Mior Muhammad Zaki [email protected]

@driesvints
Copy link
Member

driesvints commented Aug 16, 2021

Hi, I merged #38398 into 8.x to get the test suite passing again. I've put your PR in draft. Please rebase your PR against 8.x to make the tests of this PR pass. After you've done that and tests pass, mark this PR as ready for review. Thanks.

@driesvints driesvints marked this pull request as draft August 16, 2021 10:26
@crynobone crynobone force-pushed the patch-conditional-rule branch from c7e717c to 9d02a85 Compare August 16, 2021 11:16
@crynobone
Copy link
Member Author

Done @driesvints

@crynobone crynobone marked this pull request as ready for review August 16, 2021 11:18
@taylorotwell taylorotwell merged commit ae63ff4 into laravel:8.x Aug 16, 2021
@crynobone crynobone deleted the patch-conditional-rule branch November 19, 2021 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants