Get Auth::user() with its associated profile (1-1)

Posted 2 months ago by Albyzai


My use case is that I have to check if the user has a profile when logging in.

IF user has a profile -> Then i will skip the profile creation process.

ELSE -> Let the user create a profile.

I am making my backend as an API because i am using Angular as the front-end framework.

So my first question is if this would be the proper way to do it, or there is a smarter one?

Second is that I have tried using

return Auth::user()->with('profile');

but that returns the whole collection of Users with their profiles, rather than the single authenticated user.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.