Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| PickedItemDeleteService | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| store | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\PickingOrder\Services; |
| 4 | |
| 5 | use App\Events\ServiceProcessed; |
| 6 | use App\Models\PickedItem; |
| 7 | use App\Models\User; |
| 8 | use Exception; |
| 9 | use Illuminate\Support\Facades\DB; |
| 10 | |
| 11 | readonly class PickedItemDeleteService |
| 12 | { |
| 13 | |
| 14 | public function store(PickedItem $pickedItem, User $user): void |
| 15 | { |
| 16 | try { |
| 17 | DB::beginTransaction(); |
| 18 | |
| 19 | $pickedItem->delete(); |
| 20 | |
| 21 | DB::commit(); |
| 22 | } catch (Exception $exception) { |
| 23 | DB::rollBack(); |
| 24 | throw $exception; |
| 25 | } |
| 26 | |
| 27 | ServiceProcessed::dispatch(self::class, $user); |
| 28 | } |
| 29 | } |