8000 [12.x] Add `except` and `exceptHidden` methods to `Context` class by xurshudyan · Pull Request #55692 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[12.x] Add except and exceptHidden methods to Context class #55692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2025

Conversation

xurshudyan
Copy link
Contributor

This PR adds two new methods to the Context class — except and exceptHidden — which allow for selective exclusion of keys when retrieving context or hidden context data.

Context::add('user_id', 42);
Context::add('request_id', 'req-abc123');
Context::add('ip_address', '192.168.0.1');
Context::add('sensitive_token', 'secret');

$logData = Context::except(['sensitive_token']);

// Result:
[
    'user_id' => 42,
    'request_id' => 'req-abc123',
    'ip_address' => '192.168.0.1',
]

@taylorotwell taylorotwell reopened this May 9, 2025
@taylorotwell taylorotwell merged commit 6faf8de into laravel:12.x May 9, 2025
88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0