External variable in callback for chunk()
You managed to bypass the query builder, which could have implemented this as a trivial, single query on the backing database, and instead managed to emulate that query in an very inefficient manner yourself.

// get all leads
Lead::chunk(100, function($leads) use ($results, $param) {
    // search in name
    $results = array_merge($results, $this-&gt;repository-&gt;searchInName($leads, $param));

    // search in email
    $results = array_merge($results, $this-&gt;repository-&gt;searchInEmail($leads, $param));

    // and so on ...
}


This effectively causes 2 additional queries to the database for each 100 results in the Lead model. This might still work reasonably in your test environment where you have at most a few dozen leads registered, but will crawl to a halt in production as the number of leads increases with time.

Even worse, it requires you to stream all existing Lead instances through PHP, even if they are not even part of the final result set.