Skip to content
This repository was archived by the owner on Jul 31, 2018. It is now read-only.

Commit 9ba94a2

Browse files
committed
Fix issue with static call inside model with static or self keyword
1 parent 9486552 commit 9ba94a2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/AlgoliaEloquentTrait.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,30 @@ public static function __callStatic($method, $parameters)
131131
{
132132
$instance = new static();
133133
$overload_method = '_'.$method;
134+
134135
if (method_exists($instance, $overload_method)) {
135136
return call_user_func_array([$instance, $overload_method], $parameters);
136137
}
137138

138139
return parent::__callStatic($method, $parameters);
139140
}
140141

142+
/**
143+
* @param $method
144+
* @param $parameters
145+
* @return mixed
146+
*/
147+
public function __call($method, $parameters)
148+
{
149+
$overload_method = '_'.$method;
150+
151+
if (method_exists($this, $overload_method)) {
152+
return call_user_func_array([$this, $overload_method], $parameters);
153+
}
154+
155+
return parent::__call($method, $parameters);
156+
}
157+
141158
/**
142159
* Methods.
143160
*/

0 commit comments

Comments
 (0)