Support the ongoing development of Laravel.io →
Eloquent Authentication
Last updated 2 years ago.
0

Looks like you aren't passing $jeus to your view. The code you are using to attach looks fine.

Typically instead of returning a view directly from the store method, you would redirect to the index page, although it should work fine either way.

0

Couple of other things to note:

  • This line isn't doing anything, because $idUser isn't accessed again: $idUser=$user->getId;

  • You are passing a user into the method but then saving the relationship on auth()->user(). Is that definitely what you want?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Lucas meneldii Joined 14 Jun 2021

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.