Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird bug? #9

Closed
it-can opened this issue Apr 22, 2020 · 0 comments
Closed

Weird bug? #9

it-can opened this issue Apr 22, 2020 · 0 comments

Comments

@it-can
Copy link

it-can commented Apr 22, 2020

I was busy with syncing carts with logged in users just like the demo code... I noticed something something weird.

https://github.com/cartalyst/demo-cart/blob/6.x/app/Listeners/UserEventListener.php#L60

this code works

public function subscribe(Dispatcher $dispatcher): void
    {
        $dispatcher->listen('Illuminate\Auth\Events\Login', __CLASS__ . '@onUserAuthenticated');
    }

The cart is synced and the items in the database is also synced... But when I use a closure, this doesnt seem to work anymore...

public function subscribe(Dispatcher $dispatcher): void
    {
        $dispatcher->listen('Illuminate\Auth\Events\Login', function ($event) {
            $this->onUserAuthenticated();
        });
    }

Any idea why this is not working?

@it-can it-can closed this as completed Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant