Laravel 8 数据库迁移
如果你的扩展包中包含 数据库迁移,你需要使用 loadMigrationsFrom 方法告知 Laravel 如何加载它们。 loadMigrationsFrom 方法只需要扩展包迁移文件路径作为唯一参数:
/**
* 启动应用服务
*
* @return void
*/
public function boot()
{
$this->loadMigrationsFrom(__DIR__.'/path/to/migrations');
} 一旦你的扩展包迁移文件被注册,当运行 php artisan migrate 命令时它们就会被自动执行。你不需要将它们导入到应用的 database/migrations 目录中。