diff --git a/src/Model.php b/src/Model.php index 855d1ffa20..399c1b9495 100644 --- a/src/Model.php +++ b/src/Model.php @@ -820,7 +820,8 @@ public function get(string $field = null) $data[$field->short_name] = $this->get($field->short_name); } - return $data; + // return in the order of Model::$only_fields + return array_merge($this->only_fields ? array_flip($this->only_fields): [], $data); } $this->assertOnlyFieldsField($field);