Open sreinoso opened 6 years ago
hi @sreinoso , did you able to solve this?
I found the solution, just simply use $request->user('api');
in any Controller function.
No, I did not found the solution, I will try it!
@esien525 Is it possible to use multiple tables against laravel passport? I have 2 models that can be logged in, and none of them are users... is it possible or do you recommend me another approach?
@fernandocoronatomf, I forget how i do it already. Haha
But i think it is possible as it works like laravel guard.
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
'exampleapi' => [
'driver' => 'passport',
'provider' => 'someusers',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => Api\Users\Models\User::class,
],
'someusers' => [
'driver' => 'eloquent',
'model' => Api\Users\Models\SomeUser::class,
],
],
the code is not tested, but i hope it helps
Thanks for answering but perhaps I did not make myself clear. To use another Model is fine, the problem is when the models aren't linked to a user table.
i had to extend some passport classes to make it work and then switch the guard in a middleware + overwrite some other methods from passport classes.
Hi, I'm interested on get the user to return to angular2 in LoginProxy@proxy, but I did not find which class or object returns this.
I need something like this:
I thought something like
$this->auth->user()
but it seems it's not defined.What am I doing wrong?
Thanks!