Comment #⁨1⁩

Toby Toby Waterhole Founder Sep 1, 2024

Hi @Pete Swan, thanks for your question.

Take a look at the Laravel Authentication Integration docs. When implementing the HasWaterholeUser trait on your application's User model, you will want to override the toWaterholeUser() method so that it only returns a PendingUser object if the user has the correct role that allows them to access the forum:

    public function toWaterholeUser(): ?PendingUser
    {
        if (!$this->roles->contains(ROLE_ID)) {
            return null;
        }

        return new PendingUser(
            identifier: $this->getAuthIdentifier(),
            email: $this->email,
            name: $this->name,
        );
    }