klaravel/ntrust

Class name must be a valid object or a string

brandenwagner opened this issue · 13 comments

I have the ntrust.php in the config folder, but i am still getting this error.

Can you please show some code or send more detail?
So I can help you with that.

in Model.php line 939
at Model->belongsToMany(null, null, 'user_id', null) in NtrustUserTrait.php line 55
at User->roles() in NtrustUserTrait.php line 20
at User->cachedRoles() in NtrustUserTrait.php line 104
at User->hasRole('admin', false) in Ntrust.php line 36
at Ntrust->hasRole('admin') in Facade.php line 237
at Facade::__callStatic('hasRole', array('admin')) in a0f6258539f84f37e2041eaf8c8fe1ff558e277f.php line 71

The only issue i could potentially see, which i have already checked.
My models are in

    App\Models\Role
   App\Models\Permission

I have already updated that in the ntrust config on

   'role' => 'App\Models\Role',
    'permission' => 'App\Models\Permission',

I also tried putting them in the normal directory.
I am trying to integrate this with laravel spark if that might make a difference.

Im pretty sure this is the line its getting caught on:
<div id="page-wrapper" class="{{Ntrust::hasRole('admin') ? '' : 'no-sidebar'}}">

Can you please show me your model full page code and config/ntrust.php?

I have tested same thing and it's working fine for me.

What is location of your User model?

App\User
App\Team
are the only two models in the app directory

One last thing might help. Migration file.

Try this file and let me know

ntrust.txt

Same error no change.

Can you please come to gitter chat room? Or need to see more code to troubleshoot.

Still not sure what is issue. Might be php version or something else.

Many people have same issue but I have fix that issue in my code.

http://stackoverflow.com/questions/35785441/laravel-5-2-with-entrust-class-name-must-be-a-valid-object-or-a-string

Let me know if it's fix?

Still having the same issue. Sorry, i was at work all day.