| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Anomaly\Streams\Platform\Ui\Table\Component\Action\Handler; |
||
| 26 | public function handle(TableBuilder $builder, Request $request) |
||
| 27 | { |
||
| 28 | $count = 0; |
||
| 29 | |||
| 30 | $model = $builder->getTableModel(); |
||
| 31 | |||
| 32 | /* @var EloquentModel $entry */ |
||
| 33 | foreach ($request->get($builder->getTableOption('prefix') . 'order', []) as $k => $id) { |
||
| 34 | |||
| 35 | if ($entry = $model->find($id)) { |
||
|
|
|||
| 36 | |||
| 37 | $entry->sort_order = $k + 1; |
||
| 38 | |||
| 39 | $entry->save(); |
||
| 40 | |||
| 41 | $count++; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | $builder->fire('reordered', compact('count', 'builder')); |
||
| 46 | |||
| 47 | $this->messages->success(trans('streams::message.reorder_success', compact('count'))); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: