Skip to content

Commit

Permalink
Also search introduction notes
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed May 12, 2021
1 parent 67f7757 commit daf6b4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Helpers/SearchHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static function searchContacts(string $needle, string $orderByColumn, str

return Contact::search($needle, $accountId, $orderByColumn, $orderByDirection)
->notes($accountId, $needle)
->introductionAdditionalInformation($needle)
->addressBook($accountId, $addressBookName);
}
}
13 changes: 13 additions & 0 deletions app/Models/Contact/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,19 @@ public function scopeNotes($query, int $accountId = null, string $needle)
});
}

/**
* Scope a query to include contacts whose introduction notes contain the search phrase.
*
* @param Builder $query
* @return Builder
*/
public function scopeIntroductionAdditionalInformation($query, string $needle)
{
return $query->orWhere([
['first_met_additional_info', 'like', "%$needle%"],
]);
}

/**
* Scope a query to only include contacts from given address book.
* 'null' value for address book is the default address book.
Expand Down

0 comments on commit daf6b4f

Please sign in to comment.