diff --git a/src/Model.php b/src/Model.php index 1fc8dd0..9f5b7a5 100644 --- a/src/Model.php +++ b/src/Model.php @@ -25,7 +25,7 @@ * * @package Effectra\Database */ -class Model +class Model implements \JsonSerializable { use ModelEventTrait; /** @@ -1112,6 +1112,16 @@ public static function getQueryUsedAsString(): string return (string) static::getQueryUsed(); } + /** + * Specify data which should be serialized to JSON. + * + * @return array Data which can be serialized by json_encode(). + */ + public function jsonSerialize(): array + { + return $this->getEntries(); + } + /** * dump model class using `Symfony\Component\VarDumper\VarDumper` package *