GithubHelp home page GithubHelp logo

Arg 1 passed to SessionGuard::quietLogin() must implement interface Authenticatable, instance of Collection given about nova-impersonate HOT 8 CLOSED

jackcruden avatar jackcruden commented on August 27, 2024
Arg 1 passed to SessionGuard::quietLogin() must implement interface Authenticatable, instance of Collection given

from nova-impersonate.

Comments (8)

kendugu avatar kendugu commented on August 27, 2024 1

For anyone else who finds this, I had the same issue and narrowed it down. In my case it was due to explicitly binding the route user param, for example:

Route::bind('user', function ($id) {
    return is_numeric($id)
        ? User::find($id)
        : User::where('username', $id)->firstOrFail();
});

Removing this binding fixes the issue, but I'm not sure what a solution would be to allow the explicit binding.

from nova-impersonate.

KABBOUCHI avatar KABBOUCHI commented on August 27, 2024

please change it to Impersonate::make($this) and retry

from nova-impersonate.

jackcruden avatar jackcruden commented on August 27, 2024

from nova-impersonate.

KABBOUCHI avatar KABBOUCHI commented on August 27, 2024

please make sure ur custom user model has Authenticatable interface

https://github.com/laravel/laravel/blob/05e54193ba97719983a87e1944d436e8423cc1aa/app/User.php#L7-L9

from nova-impersonate.

jackcruden avatar jackcruden commented on August 27, 2024

It does extend Authenticatable, but it seems that at some point a collection is being passed instead of the user. I cannot see where.

from nova-impersonate.

KABBOUCHI avatar KABBOUCHI commented on August 27, 2024

can you debug this line?

namespace KABBOUCHI\NovaImpersonate\Http\Controllers;

check the response if $request->user() and $user_to_impersonate (https://github.com/404labfr/laravel-impersonate/blob/3b6c56a2727d5d798155bdb97ae45bc644bf83d3/src/Services/ImpersonateManager.php#L31-L41)

from nova-impersonate.

jackcruden avatar jackcruden commented on August 27, 2024

I've narrowed this down to be likely a bug on my end. It seems that when I run App\User::find($user) where $user is a User model (not just and ID), it's for some reason returning an array of $user and my own user account. Very strange.

Will do some debugging here but I'm confident this isn't an issue with nova-impersonate.

from nova-impersonate.

KABBOUCHI avatar KABBOUCHI commented on August 27, 2024

@kendugu maybe we can rename user to id, can you submit a PR?

from nova-impersonate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.