我正在开发一个托管在私有satis repo上的包。当我开始一个新的Laravel 4项目时,我需要我的回购包,它会正确安装。安装后,我想执行一些迁移和播种,但它不起作用。
根据Laravel手册,我可以从包中执行迁移:
php artisan --env=dev migrate --package="kordaat/admin"
但这不起作用,我必须这样运行:
php artisan --env=dev --path="vendor/kordaat/admin/src/database/migrations"
上述选项有效,但并非预期效果。
在我的包中,composer.json看起来像:
{
"name": "kordaat/admin",
"description": "Admin area created by Kordaat.",
"keywords": ["laravel", "framework"],
"license": "BSD-2-Clause",
"authors": [
{
"name": "Kordaat",
"email": "xxx@xxxx.xxxx"
}
],
"require": {
"php": ">=5.3.0",
"illuminate/support": "4.1.*",
"illuminate/database": "4.1.*",
"imagine/imagine": "0.6.*@dev",
"cartalyst/sentry": "2.0.*",
"ircmaxell/password-compat": "1.0.*"
},
"autoload": {
"psr-0": {
"Kordaat\Admin": "src/"
},
"classmap": [
"src/database/migrations",
"src/database/seeds",
"src/controllers",
"src/models"
]
},
"extra": {
"branch-alias": {
"dev-master": "0.1.x-dev"
}
},
"minimum-stability": "dev"
}
种子文件位于"src/database/seeds"中(如composer.json中所述)迁移位于"src/database/seeds"中,包含以下文件:"2013_07_194325_admin_users_table.php"等。
我进行了作曲家自我更新,
composer self-update
composer更新
composer update
和一个composer转储自动加载
composer dump-autoload
但是仍然没有发现迁移。
如前所述,当将migrations文件夹移到src/文件夹根目录中数据库文件夹之外时,它会按照我想要的方式工作。除了错误的文件夹位置。
php artisan --env=dev migrate --package="kordaat/admin"
Migration table created successfully.
Migrated: 2013_07_07_194325_admin_users_table
Migrated: 2013_07_07_210428_roles_table
Migrated: 2013_07_07_210933_permission_role_table
Migrated: 2013_07_07_211434_permissions_table
Migrated: 2013_07_17_144758_role_user
Migrated: 2013_07_17_145130_posts
Migrated: 2013_07_17_145413_images
Migrated: 2013_07_17_145631_settings
Migrated: 2013_07_17_150105_companions
Migrated: 2013_07_17_150120_companion_post
这一定很愚蠢,但我找不到合适的方法。谁能帮我?
您的vendor/koordat/admin-包的服务提供商是否注册为IoC的包?这可以解释为什么--package
参数不起作用。。。
http://laravel.com/docs/packages#service-提供商