environment(), ['local', 'development', 'testing'])) { $dev_auth_user_id = $request->header('X-Dev-Auth-User-Id'); if ($dev_auth_user_id) { // Load RsxAuth and Login_User model - these are core framework classes that must exist $user_class = 'App\RSpade\Core\Models\Login_User_Model'; $auth_class = 'App\RSpade\Core\Auth\RsxAuth'; // Find the user $user = $user_class::find($dev_auth_user_id); if ($user) { // Bypass normal authentication and login as this user $auth_class::login($user); // Log this for debugging if (config('app.debug')) { console_debug('AUTH', "DEV AUTH: Authenticated as user {$user->id} via X-Dev-Auth-User-Id header"); } } } } // Example: Redirect root path to login // This demonstrates how to globally redirect requests // Uncomment the following to redirect / to /login: // if ($request->path() === '/') { // return redirect('/login'); // } // Return null to continue normal dispatch return null; } /** * Unhandled route hook * * Called when no route matches the request * * @param Request $request The current request * @param array $params Combined GET values and URL parameters * @return mixed|null Return null for default 404, or a response to handle */ public static function unhandled_route(Request $request, array $params) { // Custom 404 handling logic here // Return null to use default 404 behavior return null; } }