The Wayback Machine - https://web.archive.org/web/20210116090324/https://github.com/codecasts/laravel-jwt/pull/45
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

Laravel 5.7 #45

Open
wants to merge 5 commits into
base: develop
from
Open

Laravel 5.7 #45

wants to merge 5 commits into from

Conversation

@jonagoldman
Copy link
Contributor

@jonagoldman jonagoldman commented Nov 23, 2018

The __construct method of Auth events has a new $guard argument in Laravel 5.7:

public function __construct($guard, $user, $remember)

See: https://laravel.com/docs/5.7/upgrade

We now need to pass the guard name, otherwise an error will brake the application. This PR fixes that. It will work with Laravel >= 5.7

$this->events->dispatch(new Attempting(
$credentials, false
));
$this->events->dispatch(new Attempting('jwt', $credentials, false));

This comment has been minimized.

@Anticom

Anticom Nov 26, 2018

Iirc there's $this->name available. Shouldn't this one be used? This also applies to Failed and Login.

@jonagoldman
Copy link
Contributor Author

@jonagoldman jonagoldman commented Nov 26, 2018

@Anticom you are right, my mistake. fixed.

@Anticom
Copy link

@Anticom Anticom commented Nov 27, 2018

Looks good to me now. However still not an laravel expert ;)

Edit
One more thing.
Looking at laravel/framework/src/Illuminate/Auth/SessionGuard.php the method getRequest is implemented w/o using an application reference but rather like so:

  public function getRequest() {
    return $this->request ?: Request::createFromGlobals();
  }

As far as i can tell this is the only reason, why $app would be injected into the guard and #6 is talking about the injector having issues with that. I don't know enough about the internals of laravel's DI but changing this in src/Auth/Guard.php might help with the issue.
Lastly not sure whether this should belong in this PR tho.

@jonagoldman
Copy link
Contributor Author

@jonagoldman jonagoldman commented Nov 29, 2018

@Anticom if you look at Laravel's SessionGuard.php you will see that the referenced Request class is actually Symfony\Component\HttpFoundation\Request and not Illuminate\Http\Request:

https://github.com/laravel/framework/blob/453317f5b2c93b5312392f36e0574d5be9755d0e/src/Illuminate/Auth/SessionGuard.php#L13

So we are talking about two different things here.

This package depends on Laravel and not on Symfony components, so getting the request directly from the Laravel application seems fine to me.
Also, I don't know if this is related to issue #6 as I don't have that problem.

Finally I don't know what do you mean by whether this should belong in this PR, all the changes I make to my laravel-5.7 branch will be automatically added to this PR, so I';m waiting for @hernandev to take a look at it and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.