Laravel-ide-helper: Generate Entrust model docs

Created on 7 Apr 2016  Â·  5Comments  Â·  Source: barryvdh/laravel-ide-helper

I've got an issue when i try to generate docs from which include Entrust Role and Permission models (both inherited not from \Model or \Eloquent).

Error message i've got is:

 [Symfony\Component\Debug\Exception\FatalErrorException]  
  Class name must be a valid object or a string 

I might use ignore, but I also need Entrust models.

Any suggestions?

Most helpful comment

'model' => App\User::class,

add to config/auth.php

This is because there is no follow "Zizaco/entrust" "Laravel config format" Update

look:...vendor\zizaco\entrust\src\Entrust\Traits\EntrustRoleTrait.php line:49

    public function users()
    {
        return $this->belongsToMany(Config::get('auth.model'), Config::get('entrust.role_user_table'),Config::get('entrust.role_foreign_key'),Config::get('entrust.user_foreign_key'));
       // return $this->belongsToMany(Config::get('auth.model'), Config::get('entrust.role_user_table'));
    }

"Config::get('auth.model')"!!!

All 5 comments

I have the same issue when using Entrust.

'model' => App\User::class,

add to config/auth.php

This is because there is no follow "Zizaco/entrust" "Laravel config format" Update

look:...vendor\zizaco\entrust\src\Entrust\Traits\EntrustRoleTrait.php line:49

    public function users()
    {
        return $this->belongsToMany(Config::get('auth.model'), Config::get('entrust.role_user_table'),Config::get('entrust.role_foreign_key'),Config::get('entrust.user_foreign_key'));
       // return $this->belongsToMany(Config::get('auth.model'), Config::get('entrust.role_user_table'));
    }

"Config::get('auth.model')"!!!

Please update "auth.model" to "auth.providers.users.model" in EntrustRoleTrait.php line:49. After this minor change my code worked fine.

You can fixing it with add to config.php
~
'model' => App\Models\User::class
~

You need to change your User path.

@barryvdh the package only supports L5.* and workarounds are suggested, don't think there's more todo and vote for closing this issue :}

Was this page helpful?
0 / 5 - 0 ratings