I need help with this query please.

Yoel Baez posted 3 months ago

code text hereQuerying Relationship Existence

I'm trying to get all 'Auctions' where has bids with two conditions:

  • Bids->user_id "=" current user
  • Bids->bid ">" auctions.starting_bid
$auctions = App\Auctio::whereHas('bids', function ($query) use($user) {
    $query->where('user_id', $user->id)->where('bid', '>', 'auctions.starting_bid');

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us