mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-24 04:14:57 +00:00
Adding a Welcome Mail
This commit is contained in:
parent
ea3ffaad39
commit
ee9a01651d
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
use App\User;
|
use App\User;
|
||||||
|
use App\Mail\Welcome;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
@ -63,10 +64,14 @@ class RegisterController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function create(array $data)
|
protected function create(array $data)
|
||||||
{
|
{
|
||||||
return User::create([
|
$user = User::create([
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'email' => $data['email'],
|
'email' => $data['email'],
|
||||||
'password' => Hash::make($data['password']),
|
'password' => Hash::make($data['password']),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
\Mail::to($user)->send(new Welcome($user));
|
||||||
|
|
||||||
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
35
app/Mail/Welcome.php
Normal file
35
app/Mail/Welcome.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use \App\User;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
|
||||||
|
class Welcome extends Mailable
|
||||||
|
{
|
||||||
|
public $user; //Keep this public to be accessed directly from the view.
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(User $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the message.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->markdown('emails.welcome');
|
||||||
|
}
|
||||||
|
}
|
14
resources/views/emails/welcome.blade.php
Normal file
14
resources/views/emails/welcome.blade.php
Normal file
@ -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,<br>
|
||||||
|
{{ config('app.name') }}
|
||||||
|
@endcomponent
|
Loading…
Reference in New Issue
Block a user