Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing personal team on fresh install #1460

Closed
miclaus opened this issue Mar 28, 2024 · 3 comments · Fixed by #1461
Closed

Missing personal team on fresh install #1460

miclaus opened this issue Mar 28, 2024 · 3 comments · Fixed by #1461

Comments

@miclaus
Copy link
Contributor

miclaus commented Mar 28, 2024

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 [email protected]:

Error: Ziggy error: 'team' parameter is required for route 'teams.show'.

The following in DatabaseSeeder.php:

User::factory()->create([
    'name' => 'Test User',
    'email' => '[email protected]',
]);

Should be:

User::factory()->withPersonalTeam()->create([
    'name' => 'Test User',
    'email' => '[email protected]',
]);

Related issue: #1341

I'm open to do a PR.

Steps To Reproduce

  1. composer create-project laravel/laravel:^11.0 example-app
  2. composer require laravel/jetstream
  3. php artisan jetstream:install inertia --teams --ssr --dark (--ssr and --dark might not be the issue here)
  4. npm install
  5. npm run build
  6. php artisan migrate
  7. Serve application and log in with test user [email protected]:password

The dashboard is blank and error is logged in console.

@driesvints
Copy link
Member

Hi there. This isn't a Jetstream issue. You need to add ->withPersonalTeam() manually.

@miclaus
Copy link
Contributor Author

miclaus commented Mar 28, 2024

@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().

@driesvints
Copy link
Member

@miclaus if you could send in a PR that adds it to the seeder without too many workarounds we could maybe consider it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants