Skip to content

Commit ef50bae

Browse files
authored
Merge pull request #88 from jeremymlane/getRequiredFields
implement support for getRequiredFields()
2 parents b92bbd5 + 4d41fb0 commit ef50bae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/NilPortugues/Laravel5/JsonApi/Controller/JsonApiTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ protected function createResourceCallable()
134134

135135
try {
136136
$model->save();
137+
138+
//We need to load the model from the DB in case the user is utilizing getRequiredFields() on the transformer.
139+
$model = $model->fresh();
137140
} catch (\Exception $e) {
138141
$errorBag[] = new Error('creation_error', 'Resource could not be created');
139142
throw $e;

0 commit comments

Comments
 (0)