diff --git a/src/Traits/Entities/EntityAndModel.php b/src/Traits/Entities/EntityAndModel.php index 53230c2..4561a4b 100644 --- a/src/Traits/Entities/EntityAndModel.php +++ b/src/Traits/Entities/EntityAndModel.php @@ -109,6 +109,6 @@ public function save(array $options = []) */ public function __toString() { - return $this->getId(); + return $this->getId() ?: ''; } } diff --git a/src/Traits/Entities/Modelable.php b/src/Traits/Entities/Modelable.php index 998ad78..294c225 100644 --- a/src/Traits/Entities/Modelable.php +++ b/src/Traits/Entities/Modelable.php @@ -237,7 +237,7 @@ public static function find($id) public function __toString() { // TODO: This should be tidier - return $this->getId(); + return $this->getId() ?: ''; } /**