Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| PackagingStoreService | |
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\Packaging\Services; |
| 4 | |
| 5 | use App\Events\ServiceProcessed; |
| 6 | use App\Models\Packaging\Packaging; |
| 7 | use App\Models\User; |
| 8 | use Domain\Integration\Services\IntegrationStoreService; |
| 9 | use Domain\Packaging\DTOs\PackagingDTO; |
| 10 | |
| 11 | readonly class PackagingStoreService |
| 12 | { |
| 13 | public function store(PackagingDTO $packagingDTO, User $user): Packaging |
| 14 | { |
| 15 | $packaging = new Packaging(); |
| 16 | $packaging->fill($packagingDTO->toArray()); |
| 17 | $packaging->save(); |
| 18 | |
| 19 | if ($packagingDTO->integrationPackagingDTO) { |
| 20 | (new IntegrationStoreService())->store($packagingDTO->integrationPackagingDTO, $packaging, $user); |
| 21 | } |
| 22 | |
| 23 | ServiceProcessed::dispatch(self::class, $user); |
| 24 | return $packaging; |
| 25 | } |
| 26 | } |