@@ -87,7 +87,7 @@ php artisan make:migration add_verification_to_users_table --table="users"
8787Once the migration is generated, edit the generated migration file in
8888` database/migration ` with the following lines:
8989
90- ```
90+ ``` PHP
9191 /**
9292 * Run the migrations.
9393 *
@@ -142,6 +142,7 @@ If you want to override the values, simply set the `$from` and (optional)
142142Refer to the Laravel [ documentation] ( https://laravel.com/docs/ ) for the
143143proper e-mail component configuration.
144144
145+
145146### E-mail View
146147
147148The user will receive an e-mail with a link leading to the ` getVerification() `
@@ -204,7 +205,7 @@ The view will be available in the `resources/views/vendor/laravel-user-verificat
204205Add the two (2) default routes to the ` routes/web.php ` file. Routes are
205206customizable.
206207
207- ```
208+ ``` PHP
208209 Route::get('verification/error', 'Auth\RegisterController@getVerificationError');
209210 Route::get('verification/{token}', 'Auth\RegisterController@getVerification');
210211```
@@ -335,7 +336,7 @@ Edit the `routes/web.php` file.
335336
336337- Define two (2) new routes.
337338
338- ```
339+ ``` PHP
339340 Route::get('verification/error', 'Auth\RegisterController@getVerificationError');
340341 Route::get('verification/{token}', 'Auth\RegisterController@getVerification');
341342```
@@ -351,8 +352,7 @@ Edit the `app\Http\Controllers\Auth\RegisterController.php` file.
351352- [ ] Overwrite the contructor (not mandatory)
352353- [x] Overwrite the ` register() ` method (mandatory)
353354
354- ```
355-
355+ ``` PHP
356356 namespace App\Http\Controllers\Auth;
357357
358358 use App\User;
@@ -443,7 +443,6 @@ Edit the `app\Http\Controllers\Auth\RegisterController.php` file.
443443 return redirect($this->redirectPath());
444444 }
445445 }
446-
447446```
448447
449448At this point, after registration, an e-mail is sent to the user.
@@ -454,10 +453,21 @@ If you want to perform the verification against an authenticated user you must
454453update the middleware exception to allow ` getVerification ` and
455454` getVerificationError ` routes to be accessed.
456455
457- ```
456+ ``` PHP
458457$this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]);
459458```
460459
460+ ## Relaunch the process anytime
461+
462+ If you want to regenerate and resend the verification token, you can do this with the following two lines:
463+
464+ ``` php
465+ UserVerification::generate($user);
466+ UserVerification::send($user, 'My Custom E-mail Subject');
467+ ```
468+
469+ The ` generate ` method will generate a new token for the given user and change the ` verified ` column to 0. The ` send ` method will send a new email to the user.
470+
461471## Contribute
462472
463473Feel free to comment, contribute and help. 1 PR = 1 feature.
0 commit comments