我遵循文档:http://laravel.com/docs/master/migrations#database-seeding http://laravel.com/docs/master/migrations#database-seeding
我放置了UserTableSeeder
文件附近DatabaseSeeder
. In resources/database/seeds/
folder.
这些文件没有命名空间(只有类app/
是命名空间的)。
当然有一个例外:exception 'ReflectionException' with message 'Class UserTableSeeder does not exist'
解决这个问题的最佳方法是什么?
默认的 Laravel 5 项目在其中定义了一个类映射composer.json
:
{
// ...
"autoload": {
"classmap": [
"database"
],
// ...
}
}
Run composer dump
每次添加或删除课程时database
更新 Composer 自动加载器的目录
参考:https://github.com/laravel/laravel/blob/develop/composer.json https://github.com/laravel/laravel/blob/develop/composer.json
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)