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

[9.x] Added callback support on implode Collection method. #41405

Merged
merged 2 commits into from Mar 9, 2022
Merged

[9.x] Added callback support on implode Collection method. #41405

merged 2 commits into from Mar 9, 2022

Conversation

eusonlito
Copy link
Contributor

Allow to use a callback as $value on implode Collection method to simplify ->map()->implode() calls:

Before:

<span>{{ $user->cities->map(fn ($city) => $city->name.' ('.$city->state->name.')')->implode(', ') }}</span>

After:

<span>{{ $user->cities->implode(fn ($city) => $city->name.' ('.$city->state->name.')', ', ') }}</span>

Allow to use a callback as `$value` on `implode` Collection method to simplify -`>map()->implode()` calls:

Before:

```php
<span>{{ $user->cities->map(fn ($city) => $city->name.' ('.$city->state->name.')')->implode(', ') }}</span>
```

After:

```php
<span>{{ $user->cities->implode(fn ($city) => $city->name.' ('.$city->state->name.')', ', ') }}</span>
```
@driesvints
Copy link
Member

@eusonlito this broke something: #41466

@eusonlito
Copy link
Contributor Author

Ok is_callable must be replaced with $this->useAsCallable.

@eusonlito
Copy link
Contributor Author

eusonlito commented Mar 14, 2022

@driesvints fixed with PR #41468 Sorry.

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

3 participants