PHP code example of jersyfi / laravel-verify-email

1. Go to this page and download the library: Download jersyfi/laravel-verify-email library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jersyfi / laravel-verify-email example snippets


use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Notifications\Notifiable;
use App\Traits\Auth\MustVerifyNewEmail;

class User extends Authenticatable implements MustVerifyEmail
{
    use Notifiable, MustVerifyNewEmail;
    
    public function sendEmailVerificationNotification()
    {
        $this->newEmail($this->getEmailForVerification());
    }
}

use App\Http\Controllers\Auth\VerifyNewEmailController;

Route::get('/verify-email/{id}/{hash}', [VerifyNewEmailController::class, '__invoke'])
    ->middleware(['auth', 'signed', 'throttle:6,1'])
    ->name('verification.verify');

'route' => [
    'for' => 'verification.verify',
    'after' => 'home',
],

'reset_verification' => true,

'expire' => 60,

$request->user()->syncEmail($request->input('email'));

$request->user()->getPendingEmail();

$request->user()->clearPendingEmail();
bash
php artisan migrate