Integrating with Laravel Eloquent User Model

Please include the following information in your post:

  • Which SDK this is regarding:

auth0-laravel

  • SDK Version:

dev-main

  • Platform Version:

Laravel 9

I have been following the SDK Quickstart guide at https://auth0.com/docs/quickstart/webapp/laravel-beta and this is great for auth when not persisting the user data.

I’m now encountering an issue extending the Auth0UserRepository (which does not appear to exist in the latest beta SDK however)

Is there any guidance on how to create a custom user repository and the relevant upsertUser methods with the latest SDK?

From reviewing the callback file it looks like there is a hookable event but I’m not sure on best practices for this.

        if ($user !== null) {
            // Throw hookable event to allow custom application logic for successful logins:
            $event = new \Auth0\Laravel\Event\Stateful\AuthenticationSucceeded($user);
            event($event);

            // Apply any mutations to the user object:
            auth()->guard('auth0')->setUser($event->getUser());
        }