laravel-jwt icon indicating copy to clipboard operation
laravel-jwt copied to clipboard

Return $this from login() to allow for chaining

Open grantholle opened this issue 7 years ago • 3 comments

I find myself wanting to do $auth->login($user)->issue() instead of multiple lines

grantholle avatar May 25 '18 02:05 grantholle

@grantholle even though I agree that would be a single line beauty, the login method on other guard drivers don't behave like this.

I guess they return either the user or boolean.

The token issue is the second step, for an already authenticated user.

Since it does not affect very much other stuff, I'll merge it, but I'll keep it open for a while to include this on a next release, to avoid breaking BC.

Thank you!

hernandev avatar Aug 26 '18 03:08 hernandev

Also, changed the target branch to develop. master is release only. Thanks

hernandev avatar Aug 26 '18 03:08 hernandev

Could you not just use the tap() helper method?

tap($auth)->login($user)->issue();

jakewtaylor avatar Mar 07 '19 09:03 jakewtaylor