feat: updates on expenses
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Actions\Ledgers;
|
||||
|
||||
use App\Actions\BaseAction;
|
||||
use App\Commands\Ledgers\CreateLedgerCommand;
|
||||
use App\DataObjects\CreateBalanceDTO;
|
||||
use App\DataObjects\CreateLedgerDTO;
|
||||
use Closure;
|
||||
use Spatie\LaravelData\Data;
|
||||
@@ -16,7 +17,15 @@ class CreateLedgerAction extends BaseAction
|
||||
|
||||
public function __invoke(CreateLedgerDTO|Data $payload, Closure $next)
|
||||
{
|
||||
$this->createLedgerCommand->execute($payload->data);
|
||||
$ledger = $this->createLedgerCommand->execute($payload->data);
|
||||
|
||||
$payload->balanceDTO = new CreateBalanceDTO(
|
||||
amount: $payload->amount,
|
||||
is_starting: false,
|
||||
ledger_id: $ledger->id,
|
||||
account_id: $ledger->account_id,
|
||||
branch_id: $ledger->branch_id,
|
||||
);
|
||||
|
||||
return $next($payload);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user