@@ 127-130 (lines=4) @@ | ||
124 | } |
|
125 | ||
126 | // Could swap this out for model -> getAttribute, then check if we have an attribute or a relation... getRelationValue() is helpful |
|
127 | if (method_exists($this->model, $key) && is_a(call_user_func_array([$this->model, $key], []), 'Illuminate\Database\Eloquent\Relations\Relation')) { |
|
128 | $this->saveRelation('doSave', $key, $value); |
|
129 | continue; |
|
130 | } |
|
131 | ||
132 | $this->model->setAttribute($key, $value); |
|
133 | } |
|
@@ 152-154 (lines=3) @@ | ||
149 | foreach (\Request::except('_token') as $key => $value) { |
|
150 | ||
151 | // Could swap this out for model -> getAttribute, then check if we have an attribute or a relation... getRelationValue() is helpful |
|
152 | if (method_exists($this->model, $key) && is_a(call_user_func_array([$this->model, $key], []), 'Illuminate\Database\Eloquent\Relations\Relation')) { |
|
153 | $this->saveRelation('afterSave', $key, $value); |
|
154 | } |
|
155 | } |
|
156 | ||
157 | event(new AfterSave($this)); |