$pValue = 1;
User::with(['email' => function ($q) use ($pValue ) {
$q->where('p', $pValue );
}])->get();
-- https://laracasts.com/discuss/channels/general-discussion/eager-load-with-parameters/replies/54275
or maybe a scope in the email model then calling it after the relationship.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community