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

[6.x] Fix when passed object as parameters to scopes method #37692

Merged
merged 2 commits into from
Jun 15, 2021
Merged

[6.x] Fix when passed object as parameters to scopes method #37692

merged 2 commits into from
Jun 15, 2021

Conversation

wim-web
Copy link
Contributor

@wim-web wim-web commented Jun 15, 2021

When passing parameters to the callScope method, the behavior is not what you expect because it casts them to an array.

Via the __call method it works as expected.

// some instance
$now = Carbon::now();

// it works
SomeModel::query()->date($now);

// it doesn't work
SomeModel()::query()->scopes(['date' => $now]);

Fixed calling to Arr::wrap() instead of casting to an array.

@GrahamCampbell GrahamCampbell changed the title Fix when passed object as parameters to scopes method [6.x] Fix when passed object as parameters to scopes method Jun 15, 2021
@taylorotwell taylorotwell merged commit 5e9bed2 into laravel:6.x Jun 15, 2021
@wim-web wim-web deleted the fix-scopes-method branch June 15, 2021 20:27
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.

None yet

2 participants