Class name must be a valid object or a string
Closed this issue · 3 comments
poxin13 commented
Using fresh install of Laravel 5.2 with make:auth done.
Everything appears to work great except when deleting a role. I get the error:
FatalThrowableError in Model.php line 945:
Class name must be a valid object or a string
in Model.php line 945
at Model->belongsToMany(null, 'role_user', 'role_id', 'user_id') in EntrustRoleTrait.php line 51
at EntrustRole->users() in EntrustRoleTrait.php line 79
at EntrustRole::Zizaco\Entrust\Traits\{closure}(object(Role))
at call_user_func_array(object(Closure), array(object(Role))) in Dispatcher.php line 221
at Dispatcher->fire('eloquent.deleting: App\Role', array(object(Role)), true) in Dispatcher.php line 164
at Dispatcher->until('eloquent.deleting: App\Role', object(Role)) in Model.php line 1675
at Model->fireModelEvent('eloquent.deleting: App\Role') in Model.php line 1111
at Model->delete(array()) in EntrustRoleTrait.php line 33
at EntrustRole->delete() in BaseRepository.php line 567
at BaseRepository->delete('2') in DeleteModelTrait.php line 16
at ManyToManyGateway->delete('2') in ManyToManyController.php line 157
at ManyToManyController->destroy('2')
Creating a role is fine, as well as creating/deleting permissions.
poxin13 commented
More of an issue for the Entrust main repo, apologies.
I fixed this by editing EntrustRoleTrait.php
Line 46: ... Config::get('auth.model') ...
With
Line 46: ... Config::get('auth.providers.users.model') ...
linxy49 commented
good job
maticand commented
fixed.. thanks