Skip to content
This repository has been archived by the owner on Jan 27, 2020. It is now read-only.

Commit

Permalink
minor amends
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Jul 9, 2016
1 parent 1a2f9d0 commit 5d1db39
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/Translatable.php
Expand Up @@ -75,19 +75,14 @@ protected function isJsonCastable($key)
}

/**
* Alter default Laravel behaviour when it comes to json_encode.
* This will save the json as UTF-8 to the DB
* Alter the default behaviour when it comes to using json_encode for model attributes,
* this will save the json as UTF-8 to the database instead of escaping characters.
*
* @param $value
* @param array $value
* @return string
*/
protected function asJson($value)
{
$mode = JSON_UNESCAPED_UNICODE;
if (isset($this->jsonAsUtf) && $this->jsonAsUtf == false){
$mode = 0;
}

return json_encode($value, $mode);
return json_encode($value, JSON_UNESCAPED_UNICODE);
}
}
}

0 comments on commit 5d1db39

Please sign in to comment.