初始安装后在 Laravel Jetstream 中安装 Teams 支持

Installing Teams support in Laravel Jetstream after initial install

如果我已经有一个现有的 Laravel Jetstream (Inertia) 项目,它是在没有 --teams 选项的情况下安装的,有没有办法返回并安装对团队的支持,因为我已经创建了应用程序中有多个控制器、模型、迁移和其他自定义项?

作为测试,我在我的 Jetstream LIVEWIRE 项目上通过使用 --teams 重新安装 Jetstream 来进行测试。这是可行的,但要注意一些副作用。

我做了什么:

  1. 发布 Jetstream 视图文件,如果您还没有:

    php artisan vendor:publish --tag=jetstream-views
    
  2. 将 Jetstream 更新到版本 2.0 (upgrade guide)

  3. 使用选项重新安装 Jetstream --teams:

    php artisan jetstream:install livewire --teams
    

    Warning: This will install the remaining actions, models, factories, and tests and will update several files, among those some view files, including on the layout views folder, so be careful and have them in source control or in a backup BEFORE trying this. Some view files will change entirely, so you will have to manually merge the changes with your old ones.

  4. 运行 创建的迁移