-
Notifications
You must be signed in to change notification settings - Fork 806
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
Trying to get property 'user_id' of non-object (new install with teams) #376
Comments
Where do you create your user? Only creating a User within your seeder is not enough. You also need a Team. Can you follow the registration process on the app and then log in? Cheers |
Hi there, Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels: However, this issue will not be locked and everyone is still free to discuss solutions to your problem! Thanks. |
Also need to seed a test team like so:
|
Check if user has team in the blade view.
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) |
i seem to be having this same problem.. i it was all working when i pushed to my github and later i downloaded a new copy it kept showing me these errors in my navigation-dropdown.blade.php i added in some checks for new menus and stuff like this @if (Auth::user()->hasTeams()) i mananged to get "hasTeams" to work again some how but hasTeamPermissions seems to always come back true when its not true. its like the hole thing has bug somehwere from the pull form git.. |
Um. Same problem. It's only on production for me. Maybe I missed a php artisan migrate or something. Hope this helps someone. |
@JonahKlimack for me it was because i have disabled having teams by default as i have extra code on signup to only make teams for one kind of signup... but my fix was the following.. In the AppServiceProvide.php (App/Providers) i added the following.. i could make it smaller but it works so i left it..
|
Hello @driesvints, I came here because I was following this tutorial: https://laracasts.com/series/laravel-authentication-options/episodes/2 So this is a bug with the library because it's not working out of the box, but needs to be fixed immediately, even before first run. Please reconsider your position and push a fix for it. |
Hi @DePalmo you need to run migrations first, this is because the first page "/" and "dashboard" view are already using data related to user and teams, so that is why you are required to run migrations first, it is pretty much the same as trying to register a user with "Breeze" or "Laravel UI" without running the migrations, it would throw an exception, just in this case on the first page. |
For the sake of argument, I just tried again. Another clean installation but this time only Laravel and Jetstream. Steps:
Please note that in first attempt, I was installing Laravel first, then Breeze and last Jetstream. I did run |
@DePalmo for me i have it setup so i have 2 types of users, one being normal users with no teams and based on option clicked in signup i have "networks" this user type makes a team on the signup, so i guess as long as there is a team made then it should show in the dropdown.. here is an example of my App/Fortify/CreateNewUser.php This also has a few edits for extra fields and such linking networks table to to teams and also to users ect.. class CreateNewUser implements CreatesNewUsers
} |
Read the docs carefully: https://jetstream.laravel.com/2.x/features/teams.html
You cannot have a user without a team in the default --team scaffolding. Just use |
Faced the same issue, check the routes. I had the I hope it helps someone. |
Description: ErrorException on fresh Jetstream install: Trying to get property 'user_id' of non-object
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: