diff --git a/src/ModelSearchAspect.php b/src/ModelSearchAspect.php index fb001d2..45670c2 100644 --- a/src/ModelSearchAspect.php +++ b/src/ModelSearchAspect.php @@ -100,8 +100,8 @@ public function getResults(string $term): Collection $query = ($this->model)::query(); - foreach ($this->callsToForward as $method => $parameters) { - $this->forwardCallTo($query, $method, $parameters); + foreach ($this->callsToForward as $callToForward) { + $this->forwardCallTo($query, $callToForward['method'], $callToForward['parameters']); } $this->addSearchConditions($query, $term); @@ -130,7 +130,10 @@ protected function addSearchConditions(Builder $query, string $term) public function __call($method, $parameters) { - $this->callsToForward[$method] = $parameters; + $this->callsToForward[] = [ + 'method' => $method, + 'parameters'=> $parameters, + ]; return $this; }