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.3] Move login attempt to separate method #16317

Merged
merged 1 commit into from
Nov 8, 2016
Merged

[5.3] Move login attempt to separate method #16317

merged 1 commit into from
Nov 8, 2016

Conversation

ivandokov
Copy link
Contributor

This will make it easier to alter login attempt logic without the need to override the entire login() method. For example to change credentials or add other params. A good use case is if you are checking if someone is "admin".

<?php
namespace App\Http\Controllers\Auth;
//...
class AuthController extends Controller {
    // ...
    protected function attemptLogin(Request $request)
    {
        $credentials = $this->credentials($request);
        $credentials['admin'] = 1;

        return $this->guard()->attempt($credentials, $request->has('remember'));
    }
}

If this PR is accepted it will be great to make patch for versions 5.* because it is compatible.

…n attempt logic without the need to override the entire login() method. For example to chang credentials or add other params
@ivandokov ivandokov changed the title Move login attempt to separate method [5.3] Move login attempt to separate method Nov 8, 2016
@taylorotwell taylorotwell merged commit 42d336a into laravel:5.3 Nov 8, 2016
@juukie
Copy link
Contributor

juukie commented Nov 8, 2016

Thanks! 👍

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