改名
This commit is contained in:
@@ -239,32 +239,25 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $method
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function resolveObject($data): mixed
|
private function resolveObject($method): mixed
|
||||||
{
|
{
|
||||||
if (is_numeric($data) || !is_string($data)) {
|
$resolve = $this->$method();
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
if (!method_exists($this, $data)) {
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
$resolve = $this->{$data}();
|
|
||||||
if ($resolve instanceof HasBase) {
|
if ($resolve instanceof HasBase) {
|
||||||
$resolve = $resolve->get();
|
$resolve = $resolve->get();
|
||||||
}
|
}
|
||||||
if ($resolve instanceof Collection) {
|
if ($resolve instanceof Collection) {
|
||||||
return $resolve->toArray();
|
return $resolve->toArray();
|
||||||
}
|
} else if ($resolve instanceof ActiveRecord) {
|
||||||
if ($resolve instanceof ActiveRecord) {
|
|
||||||
return $resolve->toArray();
|
return $resolve->toArray();
|
||||||
}
|
} else if (is_object($resolve)) {
|
||||||
if (is_object($resolve)) {
|
|
||||||
return get_object_vars($resolve);
|
return get_object_vars($resolve);
|
||||||
|
} else {
|
||||||
|
return $resolve;
|
||||||
}
|
}
|
||||||
return $resolve;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user