Exemplo n.º 1
0
 private function getContacts($expression)
 {
     $businesses = Business::whereIn('id', $this->scope['businessesIds'])->get();
     foreach ($businesses as $business) {
         $collection = $business->contacts()->where(function ($query) use($expression) {
             $query->where('lastname', 'like', $expression . '%')->orWhere('firstname', 'like', $expression . '%')->orWhere('nin', $expression)->orWhere('mobile', 'like', '%' . $expression);
         })->get();
         $this->results['contacts'] = $collection;
     }
 }