| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public function update($id, FragmentRequest $request) |
||
| 41 | { |
||
| 42 | $fragment = Fragment::find($id); |
||
| 43 | |||
| 44 | foreach (locales() as $locale) { |
||
| 45 | $requestAttribute = "translated_{$locale}_text"; |
||
| 46 | |||
| 47 | $fragment->setTranslation($locale, $request->get($requestAttribute)); |
||
| 48 | } |
||
| 49 | |||
| 50 | $fragment->save(); |
||
| 51 | app('cache')->flush(); |
||
| 52 | |||
| 53 | $eventDescription = fragment('back.events.updated', ['model' => 'Fragment', 'name' => $fragment->name]); |
||
| 54 | |||
| 55 | flash()->success(strip_tags($eventDescription)); |
||
| 56 | |||
| 57 | return redirect()->action('Back\FragmentsController@index'); |
||
| 58 | } |
||
| 59 | |||
| 65 |
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: