I have two model User and Profile in one to relationship.
I want to retrieve all user where profile.status == TRUE using following code.
$users = User::with(['profile' => function ($query) {
$query->where('status', TRUE);
}])->get();
dd(count($users)); //50
I have 50 users and only among of them only 3 has status == TRUE. But always it display 50.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2grzpKb
via IFTTT
Aucun commentaire:
Enregistrer un commentaire