Skip to content

Commit

Permalink
Consider another case at transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
specialtactics committed Mar 26, 2019
1 parent d83d8fe commit c5d2954
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Transformers/RestfulTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function transformKeysCase(array $transformed)
/*
* However, if the level is 1, we also want to transform the first level of keys in a json field which has been cast to array
*/
if ($levels == 1) {
if ($levels == 1 && ! is_null($this->model)) {
foreach ($this->model->getCasts() as $fieldName => $castType) {
if ($castType == 'array') {
$fieldNameFormatted = $this->formatKeyCase($fieldName);
Expand Down

0 comments on commit c5d2954

Please sign in to comment.