Skip to content

Commit

Permalink
Update Model.php
Browse files Browse the repository at this point in the history
  • Loading branch information
eusonlito authored Jun 15, 2017
1 parent de9770b commit 79b780c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Abstractor/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,23 @@ public function persist(Request $request)
}

$fields = $this->getEditFields(true);
$foreignFields = array_diff_key($fields['main'] ?? [], $this->getEditFields(false)['main'] ?? []);

if (empty($fields['main']) && $this->getRelations()->isEmpty()) {
return;
}

$foreigns = $this->getEditFields(false);

if (empty($fields['main'])) {
$fields['main'] = array();
}

if (empty($foreigns['main'])) {
$foreigns['main'] = array();
}

$foreignFields = array_diff_key($fields['main'], $foreigns['main']);

if (!empty($fields['main'])) {
$skip = null;
foreach ($fields['main'] as $key => $field) {
Expand Down

0 comments on commit 79b780c

Please sign in to comment.