Api: Route action param can be Callable ([$obj, $method])
This commit is contained in:
@@ -436,10 +436,9 @@ class mfBaseApicontroller {
|
||||
}
|
||||
|
||||
//var_dump($params);exit;
|
||||
|
||||
$req_parts = explode("/", $params);
|
||||
$req_count = count($req_parts);
|
||||
|
||||
|
||||
foreach($this->routes as $route) {
|
||||
if($route['method'] != $this->http_method) {
|
||||
continue;
|
||||
@@ -499,11 +498,17 @@ class mfBaseApicontroller {
|
||||
}
|
||||
|
||||
private function call($function, $params = []) {
|
||||
$args = $params;
|
||||
|
||||
if(count($params) === 1) {
|
||||
return $this->__call($function,reset($params));
|
||||
} else {
|
||||
return $this->__call($function,$params);
|
||||
$args = reset($params);
|
||||
}
|
||||
|
||||
if(is_array($function)) {
|
||||
return call_user_func($function, $args);
|
||||
}
|
||||
|
||||
return $this->__call($function,$args);
|
||||
}
|
||||
|
||||
protected function addRoute($route, $action, $method) {
|
||||
|
||||
Reference in New Issue
Block a user