diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index e749c07..32d4433 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Auth; use App\User; +use App\Mail\Welcome; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; @@ -63,10 +64,14 @@ class RegisterController extends Controller */ protected function create(array $data) { - return User::create([ + $user = User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); + + \Mail::to($user)->send(new Welcome($user)); + + return $user; } } diff --git a/app/Mail/Welcome.php b/app/Mail/Welcome.php new file mode 100644 index 0000000..806d6df --- /dev/null +++ b/app/Mail/Welcome.php @@ -0,0 +1,35 @@ +user = $user; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + return $this->markdown('emails.welcome'); + } +} diff --git a/resources/views/emails/welcome.blade.php b/resources/views/emails/welcome.blade.php new file mode 100644 index 0000000..af7be8b --- /dev/null +++ b/resources/views/emails/welcome.blade.php @@ -0,0 +1,14 @@ +@component('mail::message') +# Welcome, {{$user->name}}, + +Thank's for registering at **Share It!** + +Your account was created and it is active. And you? Are you ready to Share It with your friends? :) + +@component('mail::button', ['url' => 'https://shareit.brunofontes.net']) +Share it! +@endcomponent + +Thanks,
+{{ config('app.name') }} +@endcomponent