|
| 1 | +# Very short description of the package |
| 2 | + |
| 3 | +[](https://packagist.org/packages/beyondcode/laravel-confirm-email) |
| 4 | +[](https://travis-ci.org/beyondcode/laravel-confirm-email) |
| 5 | +[](https://scrutinizer-ci.com/g/beyondcode/laravel-confirm-email) |
| 6 | +[](https://packagist.org/packages/beyondcode/laravel-confirm-email) |
| 7 | + |
| 8 | +This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors. |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +You can install the package via composer: |
| 13 | + |
| 14 | +```bash |
| 15 | +composer require beyondcode/laravel-confirm-email |
| 16 | +``` |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +This package adds a `confirmed_at` and `confirmation_code` field to your users table. |
| 21 | +Publish the migration and the configuration file using |
| 22 | + |
| 23 | +```bash |
| 24 | +php artisan vendor:publish --provider=BeyondCode\EmailConfirmation\EmailConfirmationServiceProvider |
| 25 | +``` |
| 26 | + |
| 27 | +And run the migrations: |
| 28 | + |
| 29 | +```bash |
| 30 | +php artisan migrate |
| 31 | +``` |
| 32 | + |
| 33 | +### Configuring the login and register controllers |
| 34 | +In order to make use of the email verification, replace the `AuthenticatesUsers` and `RegistersUsers` traits that |
| 35 | +come with Laravel, with the ones provided by this package. |
| 36 | + |
| 37 | +These traits can be found in these two files: |
| 38 | + |
| 39 | +- `App\Http\Controllers\Auth\LoginController` |
| 40 | +- `App\Http\Controllers\Auth\RegisterController` |
| 41 | + |
| 42 | +### Add the confirmation and resend routes |
| 43 | + |
| 44 | +Add the following two routes to your `routes/web.php` file: |
| 45 | + |
| 46 | +```php |
| 47 | +Route::name('auth.resend_confirmation')->get('/register/confirm/resend', 'Auth\RegisterController@resendConfirmation'); |
| 48 | +Route::name('auth.confirm')->get('/register/confirm/{confirmation_code}', 'Auth\RegisterController@confirm'); |
| 49 | +``` |
| 50 | + |
| 51 | +### Show confirmation messages |
| 52 | + |
| 53 | +This packages adds some flash messages that contain error/information messages for your users. |
| 54 | +To show them to your users, add this to your `login.blade.php`: |
| 55 | + |
| 56 | +``` |
| 57 | +@if (session('confirmation')) |
| 58 | + <div class="alert alert-info" role="alert"> |
| 59 | + {{ session('confirmation') }} |
| 60 | + </div> |
| 61 | +@endif |
| 62 | +``` |
| 63 | + |
| 64 | +### Customization |
| 65 | +This package comes with a language file, that allows you to modify the error / confirmation messages that your user |
| 66 | +might see. In addition to that, you can change the notification class that will be used to send the confirmation code |
| 67 | +completely, by changing it in the `config/confirmation.php` file. |
| 68 | + |
| 69 | +### Testing |
| 70 | + |
| 71 | +``` bash |
| 72 | +composer test |
| 73 | +``` |
| 74 | + |
| 75 | +### Changelog |
| 76 | + |
| 77 | +Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. |
| 78 | + |
| 79 | +## Contributing |
| 80 | + |
| 81 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 82 | + |
| 83 | +### Security |
| 84 | + |
| 85 | +If you discover any security related issues, please email [email protected] instead of using the issue tracker. |
| 86 | + |
| 87 | +## Credits |
| 88 | + |
| 89 | +- [Marcel Pociot](https://github.com/mpociot) |
| 90 | +- [All Contributors](../../contributors) |
| 91 | + |
| 92 | +## License |
| 93 | + |
| 94 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
0 commit comments