Skip to content

[11.x] Add Context "missing" method#54499

Merged
taylorotwell merged 5 commits into
laravel:11.xfrom
vbergerondev:add-context-missing-method
Feb 7, 2025
Merged

[11.x] Add Context "missing" method#54499
taylorotwell merged 5 commits into
laravel:11.xfrom
vbergerondev:add-context-missing-method

Conversation

@vbergerondev
Copy link
Copy Markdown
Contributor

@vbergerondev vbergerondev commented Feb 7, 2025

I tried using the missing method on the Context facade and was surprised to find it didn’t exist. Other facades like Cache and Session have it, so it felt natural to expect it here too.

This PR adds the missing method to keep things consistent and make life a little easier for developers.

If this gets merged I'll create a PR to the docs too!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 7, 2025

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@vbergerondev vbergerondev marked this pull request as ready for review February 7, 2025 01:32
@donnysim
Copy link
Copy Markdown
Contributor

donnysim commented Feb 7, 2025

If you want to keep this consistent you should check if it's null, not if its falsy as 0, false, '' also will return as missing.

Comment thread src/Illuminate/Log/Context/Repository.php Outdated
@taylorotwell taylorotwell merged commit 454eb0d into laravel:11.x Feb 7, 2025
@vbergerondev vbergerondev deleted the add-context-missing-method branch February 7, 2025 16:13
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.

4 participants