Created
June 9, 2014 09:04
-
-
Save wouterj/f9892fc00d7d2a672fb6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| Route::get('/hello-mail/{name}', function ($name) { | |
| Mail::send('emails.hello', array('name' => $name), function ($message) { | |
| $message->to('foo@example.com', 'Foo')->subject('Someone visited /hello-mail/'); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| Route::get('/hello-mail/{name}', 'MailController@sendHello'); | |
| class MailController extends BaseController | |
| { | |
| private $mailer; | |
| // $mailer get automatically resolved by the IoC container | |
| public function __construct(\Illuminate\Mail\Mailer $mailer) | |
| { | |
| $this->mailer = $mailer; | |
| } | |
| public function sendHello($name) | |
| { | |
| $this->mailer->send('emails.hello', array('name' => $name), function ($message) { | |
| $message->to('foo@example.com', 'Foo')->subject('Someone visited /hello-mail/'); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment