jsrosas
2 years ago

hasMany with chained where() returning empty.

Posted 2 years ago by jsrosas

Hey all, how are you doing. I have a has many relation with 2 chained where clauses, when I add a third it always returns empty, even though it should find a match. Is there a limit to where clauses that can be chained?

public function tudisputes(){
        return $this->hasMany('App\Dispute', 'account_number', 'account_number_tu')->where('bureau', 'TransUnion')
                    ->where('client_id', $this->client_id);
    }

returns what its supposed to return.

public function tudisputes(){
        return $this->hasMany('App\Dispute', 'account_number', 'account_number_tu')->where('bureau', 'TransUnion')
                    ->where('date_open', $this->date_open_tu)
                    ->where('client_id', $this->client_id);
    }

Returns nothing. I am positive it should find a match in my data.

Please sign in or create an account to participate in this conversation.