stylers / laravel-email-change
Model can change own email and verify it
0.2.0
2024-01-05 15:14 UTC
Requires
- illuminate/database: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/queue: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- stylers/laravel-email-verification: dev-master
Requires (Dev)
- laravel/legacy-factories: ~1.3.2
- mockery/mockery: ^1.1|^1.6
- orchestra/testbench: ~3.0|^7.0|^8.0
- phpmd/phpmd: ^2.6|^3.0
- phpunit/phpunit: ^7.0|^8.0|^9.0|^10.0
This package is not auto-updated.
Last update: 2024-11-02 19:07:59 UTC
README
Laravel Email Change (non-released)
TODO
- Release
- Publish on Packagist
Requirements
- PHP >= 7.1.3
- Laravel ~5.x
- stylers/laravel-email-verification
Installation
composer require stylers/laravel-email-change
Publish the config of email verification package
php artisan vendor:publish --provider="Stylers\EmailVerification\Frameworks\Laravel\ServiceProvider"
Run the migrations
php artisan migrate
Usage
Set up the abstraction
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; } }
Create change request
$emailChangeableUser = User::first(); $changeRequestInstance = $emailChangeableUser->createEmailChangeRequest($newEmail);
Finish change request
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