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.6] Support multiple addresses in array #25029

Merged
merged 1 commit into from Aug 1, 2018
Merged

[5.6] Support multiple addresses in array #25029

merged 1 commit into from Aug 1, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jul 31, 2018

#23760 did a great job that added support multiple cc/bcc recipient for MailMessage.
But in most of case we don't call cc/bcc method for every single recipient, instead we want pass a array of addresses into it.

<?php

$receivers = User::query()->where('is_bcc_receiver', true)->all()->pluck('email', 'name');

// The origin way:
$message = new MailMessage;
foreach ($receivers as $name => $email) {
  $message->bcc($email, $name);
}

// This PR support the following way:
$message = (new MailMessage)
           ->bcc($receivers);

@ghost ghost changed the title support multiple addresses in array [5.6] Support multiple addresses in array Jul 31, 2018
/**
* Prepare address input for support multiple recipients.
*
* @param $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing type in phpdoc.

* @param $value
* @return array
*/
protected function prepareAddress($value): array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Laravel doesn't use return type syntax like this.

@ghost
Copy link
Author

ghost commented Jul 31, 2018

@GrahamCampbell fixed.

@taylorotwell taylorotwell merged commit 64f6f17 into laravel:5.6 Aug 1, 2018
@ghost ghost deleted the allow-multiple-receivers branch July 30, 2019 08:02
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