PHPackages                             kaoken/laravel-confirmation-email - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. kaoken/laravel-confirmation-email

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

kaoken/laravel-confirmation-email
=================================

Laravel sends confirmation mail after Auth user first registration, complete registration is done after accessing designated address.

1.1.4(8y ago)0751MITPHPPHP &gt;=7.0.0

Since Jan 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kaoken/laravel-confirmation-email)[ Packagist](https://packagist.org/packages/kaoken/laravel-confirmation-email)[ Docs](https://github.com/kaoken/veritransjp-airweb-php-laravel)[ RSS](/packages/kaoken-laravel-confirmation-email/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (2)Used By (0)

laravel-confirmation-email
==========================

[](#laravel-confirmation-email)

Laravel sends confirmation mail after Auth user first registration, complete registration is done after accessing designated address.

![Travis](https://camo.githubusercontent.com/93e9bdc997124001df0d8bf7f2dc91869204ec9f36382397ecdf5eddb4db9b37/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f727573742d6c616e672f727573742e737667)[![composer version](https://camo.githubusercontent.com/22d784800f61a71ba47d6249abf36a861f8e2e9fe15bf51598fd8ca049c62bd4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e312e342d626c75652e737667)](https://github.com/kaoken/laravel-confirmation-email)[![licence](https://camo.githubusercontent.com/84ba0b50ad44e854f0382b3a99afaef96f3d4db9e861686a3297ccd3bd397de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e63652d4d49542d626c75652e737667)](https://github.com/kaoken/laravel-confirmation-email)[![laravel version](https://camo.githubusercontent.com/173354e5a808efb589d11fac6ad6dc42e04194e2605b7fc5ea0490601dac1847/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c25323076657273696f6e2d254532253839254137352e352d7265642e737667)](https://github.com/kaoken/laravel-confirmation-email)

**Table of content**

- [Install](#install)
- [Setting](#setting)
- [Event](#event)
- [License](#license)

Install
-------

[](#install)

**composer**:

```
composer require kaoken/laravel-confirmation-email
```

Setting
-------

[](#setting)

### Add to **`config\app.php`** as follows:

[](#add-to-configappphp-as-follows)

```
    'providers' => [
        ...
        // add
        Kaoken\LaravelConfirmation\ConfirmationServiceProvider::class
    ],

    'aliases' => [
        ...
        // add
        'Confirmation' => Kaoken\LaravelConfirmation\Facades\Confirmation::class
    ],
```

### Example of adding to **`config\auth.php`**

[](#example-of-adding-to-configauthphp)

add `'confirmation' => 'users',`.

```
[
    ...
    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
        // add
        'confirmation' => 'users',
    ],
    ...
]
```

When the Auth user is `users`(**Make sure Auth user name is table name!**)

- `model` is a user model class
- `provider` is the user table name
- `email_confirmation` should modify the class derived from[Mailable](https://laravel.com/docs/5.5/mail) as necessary. Used to send confirmation mail.
- `email_registration` should modify the class derived from[Mailable](https://laravel.com/docs/5.5/mail) as necessary. Mail sent when complete registering.
- `table` is the name of the table used for this service
- If `expire` does not manipulate X hours after registration, the 1st registered user is deleted.

```
    'confirmations' => [
        'users' => [
            'model' => App\User::class,
            'path' => 'user/register/',
            'email_confirmation' => Kaoken\LaravelConfirmation\Mail\ConfirmationMailToUser::class,
            'email_registration' => Kaoken\LaravelConfirmation\Mail\RegistrationMailToUser::class,
            'table' => 'confirmation_users',
            'expire' => 24,
        ]
    ],
```

### Command

[](#command)

```
php artisan vendor:publish --tag=confirmation
```

After execution, the following directories and files are added.

- **`database`**
    - **`migrations`**
        - `2017_09_14_000001_create_confirmation_users_table.php`
- **`resources`**
    - **`lang`**
        - **`en`**
            - `confirmation.php`
        - **`ja`**
            - `confirmation.php`
    - **`views`**
        - **`vendor`**
            - **`confirmation`**
                - **`mail`**
                    - `confirmation.blade.php`
                    - `registration.blade.php`
    - `registration.blade.php`

### Migration

[](#migration)

Migration file `2017_09_14_000001_create_confirmation_users_table.php` should be modified as necessary.

```
php artisan migrate
```

### Add to kernel

[](#add-to-kernel)

Add it to the `schedule` method of `app\Console\Kernel.php`.
This is used to delete users who passed 24 hours after 1st registration.

```
    protected function schedule(Schedule $schedule)
    {
        ...
        $schedule->call(function(){
            Confirmation::broker('user')->deleteUserAndToken();
        )->hourly();
    }
```

### E-Mail

[](#e-mail)

In the configuration `config\auth.php` with the above setting, `Kaoken\LaravelConfirmation\Mail\ConfirmationMailToUser` of `email_confirmation`is used as a confirmation mail at the time of 1st registration. The template uses `views\vendor\confirmation\confirmation.blade.php`.

`Kaoken\LaravelConfirmation\Mail\RegistrationMailToUser` of `email_registration`is used as a mail informing that the complete registration was done. The template uses `views\vendor\confirmation\registration.blade.php`. Change according to the specifications of the application.

### controller

[](#controller)

Example of **1st registration**, **complete registration**, **login**

```
