22 lines
627 B
PHP
22 lines
627 B
PHP
<?php
|
|
|
|
namespace App\Domains\CostUnit\Actions\ChangeCostUnitState;
|
|
|
|
class ChangeCostUnitStateCommand {
|
|
private ChangeCostUnitStateRequest $request;
|
|
|
|
public function __construct(ChangeCostUnitStateRequest $request) {
|
|
$this->request = $request;
|
|
}
|
|
|
|
public function execute() : ChangeCostUnitStateResponse {
|
|
$response = new ChangeCostUnitStateResponse();
|
|
|
|
$this->request->costUnit->allow_new = $this->request->allowNew;
|
|
$this->request->costUnit->archived = $this->request->isArchived;
|
|
$response->success = $this->request->costUnit->save();
|
|
|
|
return $response;
|
|
}
|
|
}
|