Answer the question
In order to leave comments, you need to log in
How to use one to one relationship with Eloquent collections?
$user = Auth::user();
$project = $user->roles()->first()->project()->first();
we get the current user, then we get the user's roles in various projects, select the first role and get the project where the user has a role.
and so a question in what, how in one request to receive a collection of all projects where the user has roles?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question