Answer the question
In order to leave comments, you need to log in
Determine value from linked table with Eloquent?
I have the Users and Members tables, the Members table stores the team IDs for which the user applied. In theory, only one application has an Approved entry equal to 1.
If I have a user object in the template - how to find out if it has an Approved application in the members table?
Answer the question
In order to leave comments, you need to log in
$user = User::find();
$user->members()->where('approved', 1)->get();
if ($user->members) ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question