| Total Complexity | 4 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 10 | class BatchController extends AdminController |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Perform a batch action against selected collection. |
||
| 14 | * |
||
| 15 | * @param AdminRequest $request |
||
| 16 | * @param string $page |
||
| 17 | * @return RedirectResponse |
||
| 18 | */ |
||
| 19 | public function batch(AdminRequest $request, string $page) |
||
| 20 | { |
||
| 21 | $resource = $request->resource(); |
||
| 22 | |||
| 23 | $this->authorize($action = $request->get('batch_action'), $model = $resource->model()); |
||
| 24 | |||
| 25 | $response = $resource->actions()->exec('batch::'.$action, [$model, $request]); |
||
| 26 | |||
| 27 | if ($response instanceof Response || $response instanceof Renderable) { |
||
| 28 | return $response; |
||
| 29 | } |
||
| 30 | |||
| 31 | return back()->with( |
||
|
|
|||
| 32 | 'messages', |
||
| 33 | [trans('administrator::messages.action_success')] |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Export collection. |
||
| 39 | * |
||
| 40 | * @param AdminRequest $request |
||
| 41 | * @param string $page |
||
| 42 | * @param string $format |
||
| 43 | * @return mixed |
||
| 44 | * @throws \Exception |
||
| 45 | */ |
||
| 46 | public function export(AdminRequest $request, string $page, string $format) |
||
| 55 | } |
||
| 56 | } |
||
| 57 |