Skip to content

Commit 9de1525

Browse files
authored
Merge pull request z-song#1 from vlados/vlados-patch-1
Fix z-song#4208
2 parents 9233c5b + 898728b commit 9de1525

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Form.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -569,18 +569,23 @@ protected function getRelationInputs($inputs = []): array
569569
$relations = [];
570570

571571
foreach ($inputs as $column => $value) {
572-
$column = \Illuminate\Support\Str::camel($column);
573-
if (!method_exists($this->model, $column)) {
574-
continue;
575-
}
572+
if (method_exists($this->model, $column)) {
573+
$relation = call_user_func([$this->model, $column]);
576574

577-
$relation = call_user_func([$this->model, $column]);
575+
if ($relation instanceof Relations\Relation) {
576+
$relations[$column] = $value;
577+
}
578+
} elseif (method_exists($this->model, \Illuminate\Support\Str::camel($column))) {
579+
$column = \Illuminate\Support\Str::camel($column);
580+
$relation = call_user_func([$this->model, $column]);
578581

579-
if ($relation instanceof Relations\Relation) {
580-
$relations[$column] = $value;
581-
}
582-
}
582+
if ($relation instanceof Relations\Relation) {
583+
$relations[$column] = $value;
584+
}
585+
}
583586

587+
}
588+
584589
return $relations;
585590
}
586591

0 commit comments

Comments
 (0)