I am trying to get record with where condition in laravel elquent query. Here is my relationship method.
public function OrdersReferrals()
{
return $this->hasMany('App\Order', 'referred_by');
}
public function referrals()
{
return $this->hasMany('App\User', 'referred_by')->with('referrals', 'OrdersReferrals');
}
Here is my controller query
$userData = User::with('adminuserrreferrals')
->where('id', $id)
->where('payout_status', 'pending')
->get();
Problem Is that this query, where condition is work for only user table. while I need this ->where('payout_status','pending')
for orders table.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire