| Conditions | 5 |
| Paths | 10 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 58 | public function handle(Request $request) |
||
| 59 | { |
||
| 60 | $errors = []; |
||
| 61 | $hidden = []; |
||
| 62 | $removed = []; |
||
| 63 | foreach ($request->get('ids') as $id) { |
||
| 64 | try { |
||
| 65 | if (!$this->crud()->repo()->delete($id)) { |
||
| 66 | throw new \Exception(__('jarboe::toolbar.mass_delete.delete_event_failed')); |
||
| 67 | } |
||
| 68 | |||
| 69 | try { |
||
| 70 | $this->crud()->repo()->find($id); |
||
| 71 | $hidden[] = $id; |
||
| 72 | } catch (\Exception $e) { |
||
| 73 | $removed[] = $id; |
||
| 74 | } |
||
| 75 | } catch (\Exception $e) { |
||
| 76 | $errors[$id] = $e->getMessage(); |
||
| 77 | } |
||
| 78 | } |
||
| 79 | |||
| 80 | return response()->json([ |
||
|
|
|||
| 81 | 'errors' => $errors, |
||
| 82 | 'hidden' => $hidden, |
||
| 83 | 'removed' => $removed, |
||
| 84 | ]); |
||
| 85 | } |
||
| 86 | |||
| 95 |
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: