--level used: 5 ------ ----------------------------------------------
Line LoginController.php
------ ----------------------------------------------
62 Call to an undefined method
Illuminate\Auth\AuthManager::loginUsingId().
------ ----------------------------------------------
auth()->loginUsingId($user->id);
Could you try auth()->login($user); ?
@szepeviktor Ah nice solution. But how about that?
I know maybe it's weird, since we already had a $user. But, it's should works, right?
[Update]
Your solution isn't working, still got undefined method.
May not be related, but make sure you update for the latest version.
@nunomaduro Yeah, updated to the latest version. Still the same.
For anyone who faced this issue, maybe we can just ignore those error for now:
phpstan.neon
parameters:
ignoreErrors:
- '#Call to an undefined method Illuminate\Auth\AuthManager::login()#'
- '#Call to an undefined method Illuminate\Auth\AuthManager::loginUsingId()#'
Yep, this looks like a bug. Thanks for reporting @nmfzone
AuthManager has the magic __call method which forwards method calls to guards. We might need a new extension for this behavior.
@canvural Sure, thanks. Keep a good work guys âš¡
I am not sure if it is related to the fix:
I am on v0.5.8
It is not working properly when auth() helper is called for a custom guard.
For example, I have a custom guard 'employee' and the model is Employee which has the function latest_pending_leave_request.
when I call auth('employee')->user()->latest_pending_leave_request(), larastan says Call to an undefined method Illuminate\Contracts\Auth\Authenticatable::latest_pending_leave_request()
@devfaysal Although custom guards are not supported in Larastan, I believe your issue will be fixed in the next release. You can try to pull the master branch and check now if you want.
Most helpful comment
Yep, this looks like a bug. Thanks for reporting @nmfzone
AuthManagerhas the magic__callmethod which forwards method calls to guards. We might need a new extension for this behavior.