Missing personal team on fresh install
miclaus opened this issue · comments
Jetstream Version
5.0.0
Jetstream Stack
Inertia
Laravel Version
11.0.8
PHP Version
8.2.0
Database Driver & Version
No response
Description
When installing Jetstream (Inertia) with teams support, the example user created in DatabaseSeeder.php
isn't created with a personal team which leads to a blank dashboard and the following error being logged to console for app.js
when logging in with the test user test@example.com
:
Error: Ziggy error: 'team' parameter is required for route 'teams.show'.
The following in DatabaseSeeder.php
:
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
Should be:
User::factory()->withPersonalTeam()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
Related issue: #1341
I'm open to do a PR.
Steps To Reproduce
composer create-project laravel/laravel:^11.0 example-app
composer require laravel/jetstream
php artisan jetstream:install inertia --teams --ssr --dark
(--ssr
and--dark
might not be the issue here)npm install
npm run build
php artisan migrate
- Serve application and log in with test user
test@example.com:password
The dashboard is blank and error is logged in console.
Hi there. This isn't a Jetstream issue. You need to add ->withPersonalTeam()
manually.
@driesvints Thanks!
What do you mean with "this isn't a Jetstream issue"? Jetstream introduces the Teams functionality, no? UserFactory::withPersonalTeam()
is provided with Jetstream.
Currently anybody installing Jetstream (with teams support) on top of a fresh Laravel installation will inadvertently encounter this issue, leading to having to understand the error, google it, search GitHub issues, etc., basically individually having to figure out that ->withPersonalTeam()
has to manually be added to the database seeder.
Since Jetstream should only be installed on new Laravel applications only, this issue could very easily be remedied by copying an already working DatabaseSeeder.php
, which would include ->withPersonalTeam()
.
@miclaus if you could send in a PR that adds it to the seeder without too many workarounds we could maybe consider it 👍