Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

RSUmer's avatar

Notifications stopped working after integrating jrean library for User verification

I have Laravel Spark setup and notifications were working fine. I needed User verification on Sign up so I used jrean library, which changed the Sign up flow. But now when a User registers Notifications are not set and "trial_ends_at" field in User table is not set.

I am new to Laravel so forgive me if I have violated any Forum rules.

0 likes
2 replies
simioluwatomi's avatar

I have used Jrean's package before but not with Spark. Are you calling the UserRegistered event?

Show some code please...

RSUmer's avatar

Yes, I have called UserRegistered event. Below is the code I am using or overwritten by Jrean package.

/**
     * Handle a registration request for the application.
     *
     * @param  RegisterRequest  $request
     * @return Response
     */
    public function register(RegisterRequest $request)
    {
        $user = Spark::interact(Register::class, [$request]);
        UserVerification::generate($user);
        event(new UserRegistered($user));
        UserVerification::send($user, 'verification');
        return response()->json([
            'redirect' => '/login'
        ]);
    }

Somehow, the event listener "CreateTrialEndingNotification" that is triggered is not finding any value in Trials Ends At field. Below is the 'handle' function called on event call...

public function handle(UserRegistered $event)
    {
        if (! Spark::trialDays() || ! $event->user->trial_ends_at) {
            return;
        }

        $this->notifications->create($event->user, [
            'icon' => 'fa-clock-o',
            'body' => 'Your trial period will expire on '.$event->user->trial_ends_at->format('F jS').'.',
            'action_text' => 'Subscribe',
            'action_url' => '/settings#/subscription',
        ]);
    }

The "if" condition fails and no notification is displayed.

Please or to participate in this conversation.