🔥Events

we have added a lot of events to the package, so you can listen to them and do what you want.

OTP Event

use TomatoPHP\TomatoCrm\Events\SendOTP;
use TomatoPHP\TomatoNotifications\Services\SendNotification;

public function register()
{
    Event::listen([
        SendOTP::class
    ], function ($data) {
        $user = $data->model::find($data->modelId);

        SendNotification::make(['email'])
            ->title('OTP')
            ->message('Your OTP is ' . $user->otp_code)
            ->type('info')
            ->database(false)
            ->model(Account::class)
            ->id($user->id)
            ->privacy('private')
            ->icon('bx bx-user')
            ->url(url('/'))
            ->fire();
    });
}

Account Success Login Event

When the user logs in successfully, we fire this event.

Account Registered Event

When the user registers successfully, we fire this event.

Last updated

Was this helpful?