Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

soyiso3875's avatar

Laravel impersonate not working

I get the following error

Call to undefined method Illuminate\Database\Query\Builder::canBeImpersonated() (View: /Users/me/laravel/resources/views/users/index.blade.php)

I use this package https://github.com/404labfr/laravel-impersonate

0 likes
1 reply
bobbybouwmann's avatar
Level 88

Did you check the docs? I believe you miss a method in your User model

class User extends Model
{
    public function canBeImpersonated()
    {
        return true;
    }
}

Please or to participate in this conversation.