0

I've created a new Laravel 8 app with Jetstream and Livewire. When I make a GET request to any view an ErrorException is launched with message

Trying to get property 'user_id' of non-object

on navigation-dropdown.blade.php which is automatically generated by Jetstream\Livewire. I've looked for this user_id and didn't found on any part of the code.

Qirel
  • 25,449
  • 7
  • 45
  • 62
  • Does this answer your question? [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – miken32 Oct 08 '20 at 20:28
  • 1
    Have you created users without having a personal team? The Jetstream package has some issues with it, doesn't account for much modifications to the existing views apparently. – Qirel Oct 08 '20 at 20:57

2 Answers2

0

Check that if user has team in the blade view.

resources/views/navigation-dropdown.blade.php

In line 61:

- @if (Laravel\Jetstream\Jetstream::hasTeamFeatures())
+ @if (Laravel\Jetstream\Jetstream::hasTeamFeatures() && Auth::user()->current_team_id)

In line 162:

- @if (Laravel\Jetstream\Jetstream::hasTeamFeatures())
+ @if (Laravel\Jetstream\Jetstream::hasTeamFeatures() && Auth::user()->current_team_id)
A. Khaled
  • 1,468
  • 16
  • 28
0

Fortify adds it's own auth routes, but old routes in config/auth.php will still be used (in my case)

Simple solution is to comment out all routes in config/auth.php (if using jetstream with fortify)

and run :

php artisan route:cache

this will make sure that auth routes use fortify actions, so each new account you create will have team created

ob1y2k
  • 45
  • 5