Merge pull request #191 from aygee/get-form-value-related-model
Getting form value from related model
This commit is contained in:
commit
bcf0697d7d
3 files changed
+14
-1
No files matched your search
@@ -39,6 +39,10 @@ trait FormAccessible
|
||||
// retrieval from the model to a form that is more useful for usage.
|
||||
if ($this->hasFormMutator($key)) {
|
||||
return $this->mutateFormAttribute($key, $value);
|
||||
} else {
|
||||
|
||||
// No form mutator, let the model resolve this
|
||||
return data_get($this, $key);
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
+1
-1
@@ -1107,7 +1107,7 @@ class FormBuilder
|
||||
protected function getModelValueAttribute($name)
|
||||
{
|
||||
if (method_exists($this->model, 'getFormValue')) {
|
||||
return $this->model->getFormValue($name);
|
||||
return $this->model->getFormValue($this->transformKey($name));
|
||||
}
|
||||
|
||||
return data_get($this->model, $this->transformKey($name));
|
||||
|
||||
Reference in new issue
Block a user