Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

Fatal error when migrating (Laravel 5.2) #506

Open overint opened 8 years ago

overint commented 8 years ago

Followed setup instructions, however when I attempt to migrate I get the following error:

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]:
 >

Creating migration...

  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Fatal error: Class name must be a valid object or a string

Exception trace:
 () at /home/vagrant/work/laravel/vendor/zizaco/entrust/src/commands/MigrationCommand.php:86
 Zizaco\Entrust\MigrationCommand->createMigration() at /home/vagrant/work/laravel/vendor/zizaco/entrust/src/commands/MigrationCommand.php:58
 Zizaco\Entrust\MigrationCommand->fire() at n/a:n/a
 call_user_func_array() at /home/vagrant/work/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
 Illuminate\Container\Container->call() at /home/vagrant/work/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
 Illuminate\Console\Command->execute() at /home/vagrant/work/laravel/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /home/vagrant/work/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
 Illuminate\Console\Command->run() at /home/vagrant/work/laravel/vendor/symfony/console/Application.php:791
 Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/work/laravel/vendor/symfony/console/Application.php:186
 Symfony\Component\Console\Application->doRun() at /home/vagrant/work/laravel/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at /home/vagrant/work/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
 Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/work/laravel/artisan:35
dahaha-365 commented 8 years ago

Add table and model values into config/auth.php like:

'table' => 'admin',
'model' => App\Admin\Admin::class,
overint commented 8 years ago

Fix found here: http://stackoverflow.com/questions/34529621/how-to-fix-in-laravel-5-2-zizaco-entrustmigration-class-name-validation#

Leaving this open though.

Acrontum-Carmichael commented 8 years ago

http://stackoverflow.com/questions/34529621/how-to-fix-in-laravel-5-2-zizaco-entrustmigration-class-name-validation#answer-34615993

This answer on the page works, the accepted does not :/

darrensapalo commented 8 years ago

This is related to #531 I think. I added references and my thoughts on how/why it happened and the solution which fixed it.