PHPackages                             kaoken/laravel-email-reset - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. kaoken/laravel-email-reset

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

kaoken/laravel-email-reset
==========================

Request to change the e-mail address of the Auth user, change it after moving to the specified URL of the confirmation e-mail.

1.0.3(8y ago)35.5k3MITPHPPHP &gt;=7.0.0

Since Jan 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/kaoken/laravel-email-reset)[ Packagist](https://packagist.org/packages/kaoken/laravel-email-reset)[ Docs](https://github.com/kaoken/laravel-email-reset)[ RSS](/packages/kaoken-laravel-email-reset/feed)WikiDiscussions master Synced 2d ago

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

laravel-email-reset
===================

[](#laravel-email-reset)

Request to change the e-mail address of the Auth user, change it after moving to the specified URL of the confirmation e-mail.

[![Travis branch](https://camo.githubusercontent.com/985ecde9f3bd2d1731cfd01b6a511862db6b3b11f165173df59f456c7ec833e3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f727573742d6c616e672f727573742f6d61737465722e737667)](https://github.com/kaoken/laravel-email-reset)[![composer version](https://camo.githubusercontent.com/e42846edf2cbe4c82be8781862cc09af4e1de27f28c5b5978910214557d9d398/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e382e342e302d626c75652e737667)](https://github.com/kaoken/laravel-email-reset)[![licence](https://camo.githubusercontent.com/84ba0b50ad44e854f0382b3a99afaef96f3d4db9e861686a3297ccd3bd397de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e63652d4d49542d626c75652e737667)](https://github.com/kaoken/laravel-email-reset)[![laravel version](https://camo.githubusercontent.com/f50a3e061818b18ff3aac4a571e980f7ad3a685837bad6c97788838ec8edd4f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c25323076657273696f6e2d254532253839254137352e382d7265642e737667)](https://github.com/kaoken/laravel-email-reset)

**Table of content**

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

Install
-------

[](#install)

**composer**:

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

Setting
-------

[](#setting)

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

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

```
    'providers' => [
        ...
        // add
        Kaoken\LaravelMailReset\MailResetServiceProvider::class
    ],

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

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

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

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

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

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

```
    'email_resets' => [
        'users' => [
            'model' => App\User::class,
            'email_reset' => Kaoken\LaravelMailReset\Mail\MailResetConfirmationToUser::class,
            'table' => 'mail_reset_users',
            'expire' => 1,
        ]
    ],
```

### Command

[](#command)

```
php artisan vendor:publish --tag=mail-reset
```

After execution, the following directories and files are added.

- **`database`**
    - **`migrations`**
        - `2017_09_21_000001_create_mail_reset_users_table.php`
- **`resources`**
    - **`lang`**
        - **`en`**
            - `mail_reset.php`
        - **`ja`**
            - `mail_reset.php`
    - **`views`**
        - **`vendor`**
            - **`confirmation`**
                - **`mail`**
                    - `confirmation.blade.php`
    - `complete.blade.blade.php`

### Migration

[](#migration)

Migration file `2017_09_21_000001_create_mail_reset_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 1 hour after 1st registration.

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

### E-Mail

[](#e-mail)

In the configuration `config\auth.php` with the above setting, `Kaoken\LaravelMailReset\Mail\MailResetConfirmationToUser::class` of `email_reset`is used as a confirmation email when changing mail. The template is `views\vendor\mail_reset\mail\confirmation.blade.php`Is used. Change according to the specifications of the application.

### controller

[](#controller)

Example of changing e-mail address

```
