I have followed zizac/entrust installation tutorial from GitHub Link and faced with error:
Class name must be a valid object or a string in var/www/html/laravel_test/vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86
MigrationCommand.php file url : Link
Outut:
php artisan entrust:migration
Tables: roles, role_user, permissions, permission_role
A migration that creates 'roles', 'role_user', 'permissions', 'permission_role' tables will be created in database/migrations directory
Proceed with the migration creation? [Yes|no] (yes/no) [yes]: yes
Creating migration...
PHP Fatal error: Class name must be a valid object or a string in /var/www/html/laravel_test/vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86
the command: php artisan vendor:publish was successful.
File : config/entrust.php exist.
I didin't change any options to config/auth.php file same as - auth.php. How to fix it?
In vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86.
Laravel 5.1.* Add Line
Laravel 5.2.* Add Line
Try running:
to make sure your application is using fresh config files
EDIT
Ok, now I see, this library want to use:
but there is no something like this in
auth
any more.So as temporary workaround you should probaby add
table
andmodel
toauth
file like so: https://github.com/laravel/laravel/blob/5.1/config/auth.phpand wait until Entrust will be upgraded to remove this
in vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86
remove line :
add line :
and config/auth.php file write provider line as like me :
then your problem will solve : happy coding
The accepted answer may fix the problem but it is very bad practice to edit direct vendor files. The following will fix the issue you may be having and will support your app still working if you decide to update Entrust and they fix their codebase.
Add the following lines to config/auth.php underneath:
Laravel 5.1 - 5.4
Once Entrust rolls out an update you can remove this or keep it. Up to you.