Skip to content

[5.x] Add increment/decrement methods to ContainsData#11786

Merged
jasonvarga merged 1 commit into5.xfrom
increment-decrement
May 13, 2025
Merged

[5.x] Add increment/decrement methods to ContainsData#11786
jasonvarga merged 1 commit into5.xfrom
increment-decrement

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

@duncanmcclean duncanmcclean commented May 13, 2025

This pull request adds increment and decrement methods to the ContainsData trait, which is used pretty much everywhere.

So, instead of needing to do this:

$entry->set('inventory', $entry->get('inventory') + 1);

You can now do this:

$entry->increment('inventory');

Not related to an existing feature request, but something I thought might be useful last night while working on a personal project.

@jasonvarga jasonvarga merged commit 506f5e1 into 5.x May 13, 2025
27 checks passed
@jasonvarga jasonvarga deleted the increment-decrement branch May 13, 2025 19:50
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