Skip to content

Commit

Permalink
Merge branch 'patch-1' of https://github.com/sylwit/framework into sy…
Browse files Browse the repository at this point in the history
…lwit-patch-1
  • Loading branch information
taylorotwell committed Nov 2, 2016
2 parents d818fec + c9f0d05 commit 9667bcb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -2414,10 +2414,18 @@ public function setIncrementing($value)
*
* @param int $options
* @return string
*
* @throws \InvalidArgumentException
*/
public function toJson($options = 0)
{
return json_encode($this->jsonSerialize(), $options);
$json = json_encode($this->jsonSerialize(), $options);

if (JSON_ERROR_NONE !== json_last_error()) {
throw new InvalidArgumentException(json_last_error_msg());
}

return $json;
}

/**
Expand Down

0 comments on commit 9667bcb

Please sign in to comment.