❓ Support

Issue with user names and avatars display wrong users and deleted users in posts.

I recently integrated Waterhole into my Laravel 11 project. It was a new project with a few pages built out using TALL stack Breeze install. I didn't have a ton of crud implemented or functionality beyond basic user auth and a few additional user fields. So when I added Waterhole I decided to use one database for everything to keep things simple and I'm mostly using the Waterhole User model with a few extra field in my User model.

After I got everything running I was testing out the forum I realized that I have a bug and I'm not sure what's causing it and I'm having a hard time troubleshooting it due to my lack of experience with Laravel and PHP.

**Here's what's happening.

When I log in unauthenticated the posts show the post author name as "Deleted User" and the post user avatar displays a question mark. The post list items show the correct usernames but avatars are question marks.
Screenshot 2024-05-04 at 6.11.37 PM.png
Screenshot 2024-05-04 at 6.19.44 PM.png

When I log in as an authenticated user all the post list items show the avatar of the currently logged in user and not the post author avatar but the user names are correct. In the post the username and avatar are the currently logged in user and not the post author/user.**

Screenshot 2024-05-04 at 6.22.18 PM.png
Screenshot 2024-05-04 at 6.38.32 PM.png

I'm pretty stumped here. I've checked the posts and users in my db and the ids are all correct. Issue is in prod too on different db. Any suggestions on where to start to debug this or has anyone experience this before please me know because I've hit a wall. I suspected that maybe it was something to do with the user models creating some sort of conflict but I've checked and don't see anything that could be a problem.

ChatGPT wasn't helpful either 😅

Also there's probably a good chance that I might've screwed something up when integrating Waterhole into my Laravel 11 project. I'm new to Laravel so please bear with me 😅

Figured out my own problem and learned about assigning global view composers that use the same name as your user not being a good idea 😂

Did this in my AppServiceProvider to check user subscriptions status in various areas of my app after I integrated Lemon Squeezy and had no idea it would overwrite the users everywhere (copy pasta):

    public function boot(): void
    {
        view()->composer('*', function ($view) {
            $view->with('user', Auth::user());
        });
    }

Whelp lesson learned...

View Answer

⁨2⁩ ⁨Comments⁩

I just did a clean Laravel 11 install and integrated a clean install of Waterhole and it's working as expected fml. Any gotchas with sharing a DB between the main app and Waterhole that I should be aware of?

Answer

Figured out my own problem and learned about assigning global view composers that use the same name as your user not being a good idea 😂

Did this in my AppServiceProvider to check user subscriptions status in various areas of my app after I integrated Lemon Squeezy and had no idea it would overwrite the users everywhere (copy pasta):

    public function boot(): void
    {
        view()->composer('*', function ($view) {
            $view->with('user', Auth::user());
        });
    }

Whelp lesson learned...