Laravel Cartalyst Sentinel 无法回滚迁移

Posted

技术标签:

【中文标题】Laravel Cartalyst Sentinel 无法回滚迁移【英文标题】:Laravel Cartalyst Sentinel can't rollback migration 【发布时间】:2016-01-05 19:01:33 【问题描述】:

我无法回滚所有迁移。 当我运行php artisan migrate:reset 时,我的所有迁移都回滚,除了 Sentinel。我收到以下错误:

PHP Fatal error:  Class 'MigrationCartalystSentinel' not found in /home/vagrant/Projects/MuzzaLife/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 301
PHP Stack trace:
PHP   1. main() /home/vagrant/Projects/MuzzaLife/artisan:0
PHP   2. Symfony\Component\Console\Application->run() /home/vagrant/Projects/MuzzaLife/artisan:59
PHP   3. Symfony\Component\Console\Application->doRun() /home/vagrant/Projects/MuzzaLife/vendor/symfony/console/Symfony/Component/Console/Application.php:124
PHP   4. Symfony\Component\Console\Application->doRunCommand() /home/vagrant/Projects/MuzzaLife/vendor/symfony/console/Symfony/Component/Console/Application.php:193
PHP   5. Illuminate\Console\Command->run() /home/vagrant/Projects/MuzzaLife/vendor/symfony/console/Symfony/Component/Console/Application.php:889
PHP   6. Symfony\Component\Console\Command\Command->run() /home/vagrant/Projects/MuzzaLife/vendor/laravel/framework/src/Illuminate/Console/Command.php:100
PHP   7. Illuminate\Console\Command->execute() /home/vagrant/Projects/MuzzaLife/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:253
PHP   8. Illuminate\Database\Console\Migrations\ResetCommand->fire() /home/vagrant/Projects/MuzzaLife/vendor/laravel/framework/src/Illuminate/Console/Command.php:112
PHP   9. Illuminate\Database\Migrations\Migrator->rollback() /home/vagrant/Projects/MuzzaLife/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php:61
PHP  10. Illuminate\Database\Migrations\Migrator->runDown() /home/vagrant/Projects/MuzzaLife/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:172
PHP  11. Illuminate\Database\Migrations\Migrator->resolve() /home/vagrant/Projects/MuzzaLife/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:192
"error":"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'MigrationCartalystSentinel' not found","file":"\/home\/vagrant\/Projects\/MuzzaLife\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Migrations\/Migrator.php","line":301vagrant@homestead:~/Projects/MuzzaLife$ 

重置所有迁移包括 Cartalyst Sentinel 的正确性如何?

【问题讨论】:

找不到那个类,你是删了还是改了类名? 您是否发布了您的迁移? php artisan vendor:publish --provider="Cartalyst\Sentinel\Laravel\SentinelServiceProvider" @craig_h,这个类位于 /vendor/cartalyst/sentinel/src/migrations/2014_07_02_230147_migration_cartalyst_sentinel.php @Gravy,我正在使用 Sentinel 1.0 和 Laravel 4.2,发现此命令对我不起作用。我收到以下错误:“[InvalidArgumentException] 在“供应商”命名空间中没有定义命令。” @Gravy,我明白了。你说的是配置。我发布了配置文件,但没有迁移设置。 【参考方案1】:

以下命令应该可以解决问题:

composer dump-autoload

【讨论】:

以上是关于Laravel Cartalyst Sentinel 无法回滚迁移的主要内容,如果未能解决你的问题,请参考以下文章

Cartalyst Sentry 2,查询数据库以检查权限还是检查其他内容?

Laravel 中的 RBAC 管理

Laravel 5.5 阻止表单提交按 Enter

如何强制安装包?

如何在 Sentry 中为 Laravel 应用程序使用权限

如何强制安装软件包?