Revize 279d0c2b
Přidáno uživatelem Jiří Noháč před téměř 5 roky(ů)
app/Http/Controllers/Auth/RegisterController.php | ||
---|---|---|
3 | 3 |
namespace App\Http\Controllers\Auth; |
4 | 4 |
|
5 | 5 |
use App\Http\Controllers\Controller; |
6 |
use App\Mail\RegisterMail; |
|
6 | 7 |
use App\Providers\RouteServiceProvider; |
7 | 8 |
use App\User; |
8 | 9 |
use Illuminate\Foundation\Auth\RegistersUsers; |
9 | 10 |
use Illuminate\Support\Facades\Hash; |
11 |
use Illuminate\Support\Facades\Mail; |
|
10 | 12 |
use Illuminate\Support\Facades\Validator; |
11 | 13 |
|
12 | 14 |
class RegisterController extends Controller |
... | ... | |
64 | 66 |
*/ |
65 | 67 |
protected function create(array $data) |
66 | 68 |
{ |
67 |
//dd($data);
|
|
69 |
Mail::to($data['email'])->send(new RegisterMail());
|
|
68 | 70 |
|
69 | 71 |
return User::create([ |
70 | 72 |
'name' => $data['name'], |
app/Mail/RegisterMail.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\Mail; |
|
4 |
|
|
5 |
use Illuminate\Bus\Queueable; |
|
6 |
use Illuminate\Contracts\Queue\ShouldQueue; |
|
7 |
use Illuminate\Mail\Mailable; |
|
8 |
use Illuminate\Queue\SerializesModels; |
|
9 |
|
|
10 |
class RegisterMail extends Mailable |
|
11 |
{ |
|
12 |
use Queueable, SerializesModels; |
|
13 |
|
|
14 |
/** |
|
15 |
* Create a new message instance. |
|
16 |
* |
|
17 |
* @return void |
|
18 |
*/ |
|
19 |
public function __construct() |
|
20 |
{ |
|
21 |
// |
|
22 |
} |
|
23 |
|
|
24 |
/** |
|
25 |
* Build the message. |
|
26 |
* |
|
27 |
* @return $this |
|
28 |
*/ |
|
29 |
public function build() |
|
30 |
{ |
|
31 |
return $this->markdown('email.register'); |
|
32 |
} |
|
33 |
} |
resources/views/email/register.blade.php | ||
---|---|---|
1 |
@component('mail::message') |
|
2 |
# Register email |
|
3 |
|
|
4 |
Hello and welcome to our page. This email was sent to you due to your registration on our page. |
|
5 |
To activate your account, please click the link below.<br> |
|
6 |
|
|
7 |
@component('mail::button', ['url' => '']) |
|
8 |
Activate |
|
9 |
@endcomponent |
|
10 |
|
|
11 |
We much appreciate your initiative. |
|
12 |
|
|
13 |
Thanks,<br> |
|
14 |
{{ config('app.name') }} |
|
15 |
@endcomponent |
Také k dispozici: Unified diff
Issue #8001 @3h
Napjeni Laravelu na smtp.mailtrap.io. Pridani provtni zkusebni emailoveho templatu po registraci uzivatele. Po registraci uzivatele se tento email posle konkretne registrovanemu uzivateli.