Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| StockOutputSetPickedProductService | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| set | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\PickingOrder\Services; |
| 4 | |
| 5 | use App\Events\ServiceProcessed; |
| 6 | use App\Models\Product\Product; |
| 7 | use App\Models\StockIO\StockIO; |
| 8 | use App\Models\StockIO\StockIOProduct; |
| 9 | use App\Models\User; |
| 10 | |
| 11 | class StockOutputSetPickedProductService |
| 12 | { |
| 13 | |
| 14 | public function set(StockIO $output, Product $product, User $user): void |
| 15 | { |
| 16 | $output->stockIOProducts()->where('product_id', $product->getKey()) |
| 17 | ->each(function (StockIOProduct $stockOutputProduct) { |
| 18 | $stockOutputProduct->pick(); |
| 19 | $stockOutputProduct->save(); |
| 20 | }); |
| 21 | |
| 22 | ServiceProcessed::dispatch(self::class, $user); |
| 23 | } |
| 24 | } |