Skip to content
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

[5.2] New methods: SessionStore::increment and SessionStore::decrement #14196

Merged
merged 1 commit into from
Jul 1, 2016

Conversation

dereckson
Copy link
Contributor

@dereckson dereckson commented Jul 1, 2016

Several stores in the framework offer increment and decrement
methods as a convenient helper method for get/set.

This change implements such methods in the session store,
to ease the tracking of a state into a session.

For example you can:

        $redirectsCount = Session::increment('auth.redirects');
        if ($redirectsCount < 3) {
            // Retry to authenticate user to an external service.
        }

@dereckson dereckson changed the title New method: SessionStore::increment [5.2] New method: SessionStore::increment Jul 1, 2016
@dereckson
Copy link
Contributor Author

dereckson commented Jul 1, 2016

This targets 5.2 as it's a minor feature, fully backwards compatible.

@GrahamCampbell
Copy link
Member

Thanks. Please revert the file permission change though.

@dereckson dereckson force-pushed the session-increment branch from aabb0f7 to 0e2d1ba Compare July 1, 2016 10:31
@dereckson
Copy link
Contributor Author

You're welcome. PR updated to reset file permission change.

@taylorotwell
Copy link
Member

Do we want to add a decrement method before people start asking? 😄

@dereckson
Copy link
Contributor Author

dereckson commented Jul 1, 2016 via email

@dereckson dereckson force-pushed the session-increment branch from 0e2d1ba to 89d24e4 Compare July 1, 2016 15:21
Several stores in the framework offer increment and decrement
methods as a convenient helper method for get/set.

This change implements such methods in the session store,
to ease the tracking of a state into a session.

For example you can:
```
        $redirectsCount = Session::increment('auth.redirects');
        if ($redirectsCount < 3) {
            // Retry to authenticate user to an external service.
        }
```
@dereckson dereckson force-pushed the session-increment branch from 89d24e4 to b3743ee Compare July 1, 2016 16:58
@dereckson dereckson changed the title [5.2] New method: SessionStore::increment [5.2] New methods: SessionStore::increment and SessionStore::decrement Jul 1, 2016
@taylorotwell taylorotwell merged commit e2860de into laravel:5.2 Jul 1, 2016
@dereckson dereckson deleted the session-increment branch July 2, 2016 01:12
dereckson added a commit to nasqueron/auth-grove that referenced this pull request Jul 22, 2016
Summary:
Upstream merged a proposal of framework improvement we made for D445.

Require the last version, to get it (first version with is 5.2.40).

Reference: laravel/framework#14196

Test Plan:
After a `composer update`, framework should have the
SessionStore::increment method.

Reviewers: dereckson

Differential Revision: https://devcentral.nasqueron.org/D535
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.

3 participants