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

[5.5] Modify find eloquent collection method to accept collection #22787

Conversation

amaelftah
Copy link
Contributor

@amaelftah amaelftah commented Jan 14, 2018

this PR will allows eloquent collection find() method to accept collection

$users = User::get()->find(collect([20,40,30]))

@antonkomarev
Copy link
Contributor

antonkomarev commented Jan 14, 2018

Maybe it will be better to check for Arrayable contract?

if ($key instanceof \Illuminate\Contracts\Support\Arrayable) {
    $key = $key->toArray();
}

@amaelftah
Copy link
Contributor Author

@a-komarev thanks

@amaelftah amaelftah changed the title [5.5] Modify find eloquent method to accept collection [5.5] Modify find eloquent collection method to accept collection Jan 14, 2018
@carusogabriel
Copy link
Contributor

@Te7a-Houdini Do you have a use case better than collect([1, 2, 3])?

You are duplicating and complicating some unnecessary work 😅

@taylorotwell taylorotwell merged commit 0f985bb into laravel:5.5 Jan 14, 2018
@elynnaie
Copy link

@carusogabriel

$collection = collect();

// Complicated logic

$users = User::get()->find($collection);

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.

5 participants