| Conditions | 2 |
| Paths | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function handleRenderRepeaterItem($request, $fieldName) |
||
| 23 | { |
||
| 24 | $this->init(); |
||
| 25 | $this->bound(); |
||
| 26 | |||
| 27 | $errorMessages = new MessageBag($request->get('errors', [])); |
||
| 28 | view()->share( |
||
|
|
|||
| 29 | 'errors', $errorMessages ?: new ViewErrorBag() |
||
| 30 | ); |
||
| 31 | |||
| 32 | /** @var Repeater $repeater */ |
||
| 33 | $repeater = $this->crud()->getFieldByName($fieldName); |
||
| 34 | |||
| 35 | return response()->json([ |
||
| 36 | 'view' => $repeater->getRepeaterItemFormView( |
||
| 37 | $request->get('data') |
||
| 38 | )->render(), |
||
| 39 | ]); |
||
| 40 | } |
||
| 41 | |||
| 46 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: