- Release
- Publish on Packagist
- PHP >= 7.1.3
- Laravel ~5.x
- stylers/laravel-email-verification
composer require stylers/laravel-email-change
php artisan vendor:publish --provider="Stylers\EmailVerification\Frameworks\Laravel\ServiceProvider"
php artisan migrate
use Illuminate\Database\Eloquent\Model;
use Stylers\EmailVerification\NotifiableInterface;
use Illuminate\Notifications\Notifiable;
use Stylers\EmailVerification\EmailVerifiableInterface;
use Stylers\EmailVerification\Frameworks\Laravel\Models\Traits\EmailVerifiable;
use Stylers\EmailChange\Contracts\EmailChangeableInterface;
use Stylers\EmailChange\Models\Traits\EmailChangeable;
class User extends Model implements NotifiableInterface, EmailVerifiableInterface, EmailChangeableInterface
{
use Notifiable;
use EmailVerifiable;
use EmailChangeable;
...
public function getName(): string
{
return (string)$this->name;
}
}
$emailChangeableUser = User::first();
$changeRequestInstance = $emailChangeableUser->createEmailChangeRequest($newEmail);
This package requires Laravel Email Verification package and the ChangeEmail listener handle it's VerificationSuccess event. If you want to finish change request, you have to implement email-verification route. Read more: https://github.com/stylers-llc/laravel-email-verification#example-of-verification