App\Services\Notification\MailNotifier::to PHP Method

to() public method

Recipient of notification.
public to ( string $to ) : App\Services\Notification\NotifierInterface
$to string The recipient
return App\Services\Notification\NotifierInterface Return self for chainability
    public function to($to)
    {
        $this->to = $to;
        return $this;
    }

Usage Example

Example #1
0
 public function test_Should_SendEmailNotification_When_ToAddressIsSet()
 {
     $mockSwiftMailer = $this->mock('Swift_Mailer');
     $mockSwiftMailTransport = $this->mockPartial('Swift_MailTransport');
     $mockSwiftMailer->shouldReceive('send');
     $mockSwiftMailer->shouldReceive('getTransport')->andReturn($mockSwiftMailTransport);
     $this->app['mailer']->setSwiftMailer($mockSwiftMailer);
     $notifier = new MailNotifier();
     $notifier->to('*****@*****.**')->notify('Subject', 'Message');
 }