-
app/Models/User.php
Open in GitHubuse Illuminate\Foundation\Auth\User as Authenticatable; use App\Mail\User\WelcomeEmail; class User extends Authenticatable { // public static function boot() { parent::boot(); static::created(function ($user) { \Mail::to($user)->send(new WelcomeEmail($user)); }); } }
-
app/Mail/User/WelcomeEmail.php
Open in GitHubuse App\Models\User; use Illuminate\Mail\Mailable; class WelcomeEmail extends Mailable { public $user; public function __construct(User $user) { $this->user = $user; } public function build() { return $this ->subject('Welcome to ' . config('app.name') . ' ?') ->markdown('emails.user.welcome'); } }