Email Verification in afterCreate() event

Hello,
I have an application with two panels: admin and employee

Admin creates employee accounts and sends the email for verification

i use the code below in afterCreate() event

use Filament\Notifications\Auth\VerifyEmail;
use Filament\Facades\Filament;

protected function afterCreate(): void
{
    $user = $this->getRecord();

    $notification = new VerifyEmail();
    $notification->url = Filament::getVerifyEmailUrl($user);
    $user->notify($notification);
}

the email is sent correctly but Employee not have permission to access admin Panel and can't confirm the mail


How can I solve the problem?
Was this page helpful?