We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -268,26 +268,26 @@ |
||
268 | 268 | */ |
269 | 269 | public function getRelationModel($relationString, $length = null, $model = null) |
270 | 270 | { |
271 | - if(!$model = $this->model->find($this->getLastParameter())) |
|
272 | - { |
|
273 | - $model = $this->model; |
|
274 | - } |
|
271 | + if(!$model = $this->model->find($this->getLastParameter())) |
|
272 | + { |
|
273 | + $model = $this->model; |
|
274 | + } |
|
275 | 275 | |
276 | - $relationArray = explode('.', $relationString); |
|
276 | + $relationArray = explode('.', $relationString); |
|
277 | 277 | |
278 | - if (! isset($length)) { |
|
279 | - $length = count($relationArray); |
|
280 | - } |
|
278 | + if (! isset($length)) { |
|
279 | + $length = count($relationArray); |
|
280 | + } |
|
281 | 281 | |
282 | - if (! isset($model)) { |
|
283 | - $model = $this->model; |
|
284 | - } |
|
282 | + if (! isset($model)) { |
|
283 | + $model = $this->model; |
|
284 | + } |
|
285 | 285 | |
286 | - $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
287 | - return $obj->$method()->getRelated(); |
|
288 | - }, $model); |
|
286 | + $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
287 | + return $obj->$method()->getRelated(); |
|
288 | + }, $model); |
|
289 | 289 | |
290 | - return get_class($result); |
|
290 | + return get_class($result); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | // show a success message |
127 | 127 | if($this->crud->model::find($item->id)) |
128 | - \Alert::success(trans('backpack::crud.insert_success'))->flash(); |
|
128 | + \Alert::success(trans('backpack::crud.insert_success'))->flash(); |
|
129 | 129 | |
130 | 130 | // save the redirect choice for next time |
131 | 131 | $this->setSaveAction(); |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | if($this->crud->eagerLoad && !empty($this->crud->eagerLoad)) |
160 | 160 | foreach($this->crud->eagerLoad as $relation_name) |
161 | 161 | { |
162 | - if($this->data['entry'] && $rel = $this->data['entry']->{$relation_name}) |
|
163 | - { |
|
164 | - foreach($this->data['fields'] as $field_name => $field) |
|
165 | - { |
|
166 | - if(starts_with($field_name, $relation_name)) |
|
167 | - { |
|
162 | + if($this->data['entry'] && $rel = $this->data['entry']->{$relation_name}) |
|
163 | + { |
|
164 | + foreach($this->data['fields'] as $field_name => $field) |
|
165 | + { |
|
166 | + if(starts_with($field_name, $relation_name)) |
|
167 | + { |
|
168 | 168 | $column_name = str_replace("{$relation_name}.", '', $field_name); |
169 | 169 | |
170 | 170 | $this->data['fields'][$field_name]['value'] = $rel->{$column_name}; |
171 | - } |
|
172 | - } |
|
173 | - } |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package |
@@ -271,23 +271,23 @@ discard block |
||
271 | 271 | |
272 | 272 | public function handleEagerLoad($item) |
273 | 273 | { |
274 | - collect($this->crud->eagerLoad)->each(function($relation_name, $key) use ($item) |
|
275 | - { |
|
276 | - $data = collect(request()->all()) |
|
277 | - ->filter(function($value, $key) use ($relation_name) |
|
278 | - { |
|
279 | - return starts_with($key, $relation_name); |
|
280 | - }) |
|
281 | - ->mapWithKeys(function($value, $key) use ($relation_name) |
|
282 | - { |
|
283 | - return [str_replace("{$relation_name}_", '', $key) => $value ?? '']; |
|
284 | - }) |
|
285 | - ->toArray(); |
|
286 | - |
|
287 | - if(!$rel = $item->{$relation_name}) |
|
288 | - $item->{$relation_name}()->create($data); |
|
289 | - else |
|
290 | - $item->{$relation_name}->update($data); |
|
291 | - }); |
|
274 | + collect($this->crud->eagerLoad)->each(function($relation_name, $key) use ($item) |
|
275 | + { |
|
276 | + $data = collect(request()->all()) |
|
277 | + ->filter(function($value, $key) use ($relation_name) |
|
278 | + { |
|
279 | + return starts_with($key, $relation_name); |
|
280 | + }) |
|
281 | + ->mapWithKeys(function($value, $key) use ($relation_name) |
|
282 | + { |
|
283 | + return [str_replace("{$relation_name}_", '', $key) => $value ?? '']; |
|
284 | + }) |
|
285 | + ->toArray(); |
|
286 | + |
|
287 | + if(!$rel = $item->{$relation_name}) |
|
288 | + $item->{$relation_name}()->create($data); |
|
289 | + else |
|
290 | + $item->{$relation_name}->update($data); |
|
291 | + }); |
|
292 | 292 | } |
293 | 293 | } |