Conditions | 4 |
Paths | 5 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
57 | public function handle(Request $request) |
||
58 | { |
||
59 | $errors = []; |
||
60 | $restored = []; |
||
61 | foreach ($request->get('ids') as $id) { |
||
62 | try { |
||
63 | if (!$this->crud()->repo()->restore($id)) { |
||
64 | throw new \Exception(__('jarboe::toolbar.mass_restore.restore_event_failed')); |
||
|
|||
65 | } |
||
66 | $restored[] = $id; |
||
67 | } catch (\Exception $e) { |
||
68 | $errors[$id] = $e->getMessage(); |
||
69 | } |
||
70 | } |
||
71 | |||
72 | return response()->json([ |
||
73 | 'errors' => $errors, |
||
74 | 'restored' => $restored, |
||
75 | ]); |
||
86 |