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

[1.x] Rename fields method and return an object #257

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

jessarcher
Copy link
Member

This PR makes a minor tweak to the unreleased changes in #251, based on what felt better when writing the docs.

It renames the fields method to find and returns an object instead of an array because objects feel nicer to work with in Blade views.

Before

$users = Pulse::resolveUsers($aggregates->pluck('key'));

$aggregates->map(fn ($aggregate) => (object) [
    'user' => (object) $users->fields($aggregate->key),
    // ...
]);

After

$users = Pulse::resolveUsers($aggregates->pluck('key'));

$aggregates->map(fn ($aggregate) => (object) [
    'user' => $users->find($aggregate->key),
    // ...
]);

@taylorotwell taylorotwell merged commit 38983d7 into 1.x Dec 22, 2023
12 checks passed
@taylorotwell taylorotwell deleted the user-resolving-tweaks branch December 22, 2023 14:36
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