无法 运行 在 Laravel 上播种
Can not run Seeding on Laravel
Docker 18.09.2
Mysql 5.7
Laravel 5.7
PHP 7.125
我是 Laravel 的新手,我遇到了问题 当我使用 php artisan db:seed
时,出现了这个错误:
include(/var/www/laravel_app/vendor/composer/../../database/seeds/AdminsTableSeeder.php):
failed to open stream: No such file or directory
at /var/www/laravel_app/vendor/composer/ClassLoader.php:444
440| * Prevents access to $this/self from included files.
441| */
442| function includeFile($file)
443| {
> 444| include $file;
445| }
446|
我不知道为什么会这样。
我用php artisan migrate
.
没有报错
我已经尝试了 php artisan migrate --seed
和 php artisan migrate:refresh --seed
。
谁能帮帮我?
您应该尝试使用 composer dump-autoload
。
来自 SO 中的回答:
Basically, because Composer can't see the migration files you are
creating, you are having to run the dump-autoload command which won't
download anything new, but looks for all of the classes it needs to
include again. It just regenerates the list of all classes that need
to be included in the project (autoload_classmap.php), and this is why
your migration is working after you run that command.
Docker 18.09.2
Mysql 5.7
Laravel 5.7
PHP 7.125
我是 Laravel 的新手,我遇到了问题 当我使用 php artisan db:seed
时,出现了这个错误:
include(/var/www/laravel_app/vendor/composer/../../database/seeds/AdminsTableSeeder.php): failed to open stream: No such file or directory
at /var/www/laravel_app/vendor/composer/ClassLoader.php:444
440| * Prevents access to $this/self from included files.
441| */
442| function includeFile($file)
443| {
> 444| include $file;
445| }
446|
我不知道为什么会这样。
我用php artisan migrate
.
我已经尝试了 php artisan migrate --seed
和 php artisan migrate:refresh --seed
。
谁能帮帮我?
您应该尝试使用 composer dump-autoload
。
来自
Basically, because Composer can't see the migration files you are creating, you are having to run the dump-autoload command which won't download anything new, but looks for all of the classes it needs to include again. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php), and this is why your migration is working after you run that command.