data not coming after using parent join

I have used tutorial and its great for any.

all working fine but I get stuck after adding "Scenario 3 Steps"

// filter by parent name

$query->joinWith(['parent' => function ($q) {

    $q->where('parent.first_name LIKE "%' . $this->parentName . '%" ' .

    'OR parent.last_name LIKE "%' . $this->parentName . '%"');


it fires mysql query like:

SELECT COUNT(*) FROM person LEFT JOIN country ON person.country_id = LEFT JOIN person parent ON = parent.parent_id WHERE parent.first_name LIKE "%%" OR parent.last_name LIKE "%%"

which doesnt returns any records.

so how to fix it?