安装
安装
安装 Jetstream
你可以使用 Composer 将 Jetstream 到你的新Laravel项目中:
composer require laravel/jetstream
安装完 Jetstream 包后, 你可以执行jetstream:install
Artisan 命令.
这个命令接受你喜欢的技术栈的名称( livewire
或 inertia
)。此外,你可以使用 --teams
参数来启用团队支持。
jetstream:install
命令也将安装一套 “feature(功能)” 测试,为 Jetstream 提供的功能提供测试覆盖范围。
如果你想使用Pest PHP进行测试,你可以使用 --pest
参数来安装 Pest 测试组件而不是默认的PHPUnit测试组件。
强烈建议在开始你的 Jetstream 项目之前,阅读 Livewire 或 Inertia 整个文档。
警告:只能是新的应用程序
Jetstream 只能被安装到新的 Laravel 应用程序中。尝试将 Jetstream 安装到现有的 Laravel 应用程序将导致意外的行为和问题。
安装带有 Livewire 技术栈的 Jetstream
php artisan jetstream:install livewire
php artisan jetstream:install livewire --teams
或者, 安装带有 Inertia 技术栈的 Jetstream
php artisan jetstream:install inertia
php artisan jetstream:install inertia --teams
Inertia 技术栈也可以安装SSR支持:
php artisan jetstream:install inertia --ssr
你可以在 Laravel Vite plugin 和 Inertia 文档中阅读更多关于运行SSR服务器的信息。
暗黑模式
如果你想在应用程序安装前端技术栈时支持 “暗黑模式”,请在执行 jetstream:install
命令时提供 --dark
指令:
php artisan jetstream:install livewire --dark
安装完成
安装完 Jetstream 后,你应该安装和构建你的 NPM 依赖项,并迁移你的数据库:
npm install
npm run build
php artisan migrate
应用程序 Logo
安装完 Jetstream 后,你可能已经注意到 Jetstream 的认证页面以及你的应用程序的顶部导航栏都使用了 Jetstream 的 logo 。你可以通过修改一些 Jetstream 组件来轻松自定义 logo 。
Livewire
如果你使用 Livewire 技术栈,则应在以下 Blade 组件中自定义 SVG:
resources/views/components/application-logo.blade.php
resources/views/components/application-mark.blade.php
resources/views/components/authentication-card-logo.blade.php
Inertia
如果你使用 Inertia 技术栈,则应在以下 Vue 组件中自定义 SVG:
resources/js/Components/ApplicationLogo.vue
resources/js/Components/ApplicationMark.vue
resources/js/Components/AuthenticationCardLogo.vue
自定义这些组件后,你应该重新构建你的资源:
npm run build
升级指南
要从以前的版本升级到 Jetstream 3.x,请参阅我们的 升级指南 。
推荐文章: