Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| CostCenterStoreService | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| store | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\CostCenter\Services; |
| 4 | |
| 5 | use App\Events\ServiceProcessed; |
| 6 | use App\Models\CostCenter\CostCenter; |
| 7 | use App\Models\User; |
| 8 | |
| 9 | use Domain\Integration\Services\IntegrationStoreService; |
| 10 | use Domain\CostCenter\DTOs\StoreCostCenterDTO; |
| 11 | |
| 12 | readonly class CostCenterStoreService |
| 13 | { |
| 14 | public function store(StoreCostCenterDTO $storeCostCenterDTO, User $user): CostCenter |
| 15 | { |
| 16 | $conversion = new CostCenter(); |
| 17 | $conversion->fill($storeCostCenterDTO->toArray()); |
| 18 | $conversion->save(); |
| 19 | |
| 20 | (new IntegrationStoreService())->store($storeCostCenterDTO->integration, $conversion, $user); |
| 21 | |
| 22 | ServiceProcessed::dispatch(self::class, $user); |
| 23 | return $conversion; |
| 24 | } |
| 25 | } |