Laravel Multi-Role/Multi-Tenant Auth: Customer Login Redirect Loop (Session/Middleware Issue)

I’m facing a persistent and unusual issue with a multi-role, multi-tenant Laravel application and I’m hoping someone can shed some light on what might be happening.
The Goal:I have a multi-tenant application where each tenant is a hotel. The application has four main user roles:
1.Admin (Super Admin)
2.Hotel Manager (Manages a specific hotel/tenant)
3.Branch Manager (Manages a branch under a hotel)
4.Customer (Belongs to a specific hotel/tenant)
The Problem:Logins for Admin, Hotel Manager, and Branch Manager work perfectly. However, when a Customer tries to log in, they are stuck in a redirect loop back to the login page.The laravel.log file clearly shows that the customer authentication is successful, a session is created, and a redirect to /customer/dashboard is initiated. But the user never reaches the dashboard and is immediately sent back to the login page.
My Environment:
•PHP: 8.2.12
•Framework: Laravel (latest version)
•Local Server: XAMPP, served with php artisan serve –port=8001
•Authentication: Custom login logic (not using standard Laravel Fortify/Jetstream).
What I’ve Tried (The Debugging Journey):This is where it gets strange. The core of the problem seems to be that my application is not loading the updated versions of certain PHP files, specifically my middleware.
1.Initial Diagnosis: I suspected an issue in my CustomerAuth middleware or the CustomerDashboardController. I added detailed Log::info() statements to CustomerAuth.php to trace the session state.
2.The Core Issue – Files Not Updating: The detailed logs I added never appear in laravel.log. This proves that despite my changes, Laravel is still running an old, cached, or otherwise outdated version of CustomerAuth.php.
3.Troubleshooting Steps Taken (Repeatedly):
•Cleared all caches: I have run php artisan optimize:clear, config:clear, cache:clear, view:clear, and route:clear countless times.
•Restarted the server: I have stopped (Ctrl+C) and restarted the php artisan serve process after every change.
•Cleared browser cache: Performed a hard refresh and cleared all site data from the browser.
•Checked file paths: The file path is correct: C:xampphtdocsmyprojectappHttpMiddlewareCustomerAuth.php.
•Composer Dump-Autoload: I ran composer dump-autoload successfully.
4.Isolating the Session: To confirm that the session itself was working, I modified my LoginController to redirect customers to a temporary, unprotected route (/customer/test-session). This worked! The test page loaded and successfully displayed the customer’s session data.
This proves:
•The customer session is being created and persists correctly after login.
•The problem is triggered when the request hits the customer.auth middleware or the associated controller/route.
The Block:Even after proving the session works, and after restoring the original LoginController logic, I am still unable to get my application to execute the updated CustomerAuth.php file containing the debug logs. The laravel.log remains clean of my new log statements, and the customer is still stuck in the login loop.My Question:Given that I’ve cleared all standard caches and restarted the server, what could possibly be preventing Laravel (specifically when running under php artisan serve on Windows/XAMPP) from loading the latest version of a PHP file? Is there a deeper caching mechanism (like Opcache, though I haven’t configured it explicitly) or a known issue with this kind of setup that I’m missing?I’m at a loss for why this one specific middleware file refuses to update in the running application.
Any help or new ideas for debugging this environment-specific issue would be greatly appreciated.
Thank you