mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-24 19:59:10 -04:00
ALPHA 3.0.2a
This commit is contained in:
@@ -186,7 +186,7 @@ class MailChannel
|
||||
|
||||
return collect($recipients)->mapWithKeys(function ($recipient, $email) {
|
||||
return is_numeric($email)
|
||||
? [(is_string($recipient) ? $recipient : $recipient->email)]
|
||||
? [$email => (is_string($recipient) ? $recipient : $recipient->email)]
|
||||
: [$email => $recipient];
|
||||
})->all();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class SlackWebhookChannel
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param \Illuminate\Notifications\Notification $notification
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @return void
|
||||
*/
|
||||
public function send($notifiable, Notification $notification)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace Illuminate\Notifications\Messages;
|
||||
|
||||
use Traversable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
|
||||
class MailMessage extends SimpleMessage
|
||||
{
|
||||
/**
|
||||
@@ -144,7 +147,11 @@ class MailMessage extends SimpleMessage
|
||||
*/
|
||||
public function replyTo($address, $name = null)
|
||||
{
|
||||
$this->replyTo[] = [$address, $name];
|
||||
if ($this->arrayOfAddresses($address)) {
|
||||
$this->replyTo += $this->parseAddresses($address);
|
||||
} else {
|
||||
$this->replyTo[] = [$address, $name];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -152,13 +159,17 @@ class MailMessage extends SimpleMessage
|
||||
/**
|
||||
* Set the cc address for the mail message.
|
||||
*
|
||||
* @param string $address
|
||||
* @param array|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function cc($address, $name = null)
|
||||
{
|
||||
$this->cc[] = [$address, $name];
|
||||
if ($this->arrayOfAddresses($address)) {
|
||||
$this->cc += $this->parseAddresses($address);
|
||||
} else {
|
||||
$this->cc[] = [$address, $name];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -166,13 +177,17 @@ class MailMessage extends SimpleMessage
|
||||
/**
|
||||
* Set the bcc address for the mail message.
|
||||
*
|
||||
* @param string $address
|
||||
* @param array|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function bcc($address, $name = null)
|
||||
{
|
||||
$this->bcc[] = [$address, $name];
|
||||
if ($this->arrayOfAddresses($address)) {
|
||||
$this->bcc += $this->parseAddresses($address);
|
||||
} else {
|
||||
$this->bcc[] = [$address, $name];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -230,4 +245,30 @@ class MailMessage extends SimpleMessage
|
||||
{
|
||||
return array_merge($this->toArray(), $this->viewData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the multi-address array into the necessary format.
|
||||
*
|
||||
* @param array $value
|
||||
* @return array
|
||||
*/
|
||||
protected function parseAddresses($value)
|
||||
{
|
||||
return collect($value)->map(function ($address, $name) {
|
||||
return [$address, is_numeric($name) ? null : $name];
|
||||
})->values()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given "address" is actually an array of addresses.
|
||||
*
|
||||
* @param mixed $address
|
||||
* @return bool
|
||||
*/
|
||||
protected function arrayOfAddresses($address)
|
||||
{
|
||||
return is_array($address) ||
|
||||
$address instanceof Arrayable ||
|
||||
$address instanceof Traversable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class SendQueuedNotifications implements ShouldQueue
|
||||
public $notification;
|
||||
|
||||
/**
|
||||
* All of the channels to send the notification too.
|
||||
* All of the channels to send the notification to.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user