- Move create/edit logic from relation managers to dedicated resource pages - Add transaction handling with proper rollback in sale create/update - Fix expense transaction creation by using correct array access - Set default client from query parameter in sale/expense forms - Exclude 'type' field from balance creation to prevent errors
23 lines
519 B
PHP
23 lines
519 B
PHP
<?php
|
|
|
|
namespace App\Actions\Balances;
|
|
|
|
use App\Actions\BaseAction;
|
|
use App\Commands\Balances\CreateBalanceCommand;
|
|
use Closure;
|
|
use Spatie\LaravelData\Data;
|
|
|
|
class CreateBalanceAction extends BaseAction
|
|
{
|
|
public function __construct(
|
|
private CreateBalanceCommand $createBalanceCommand
|
|
) {}
|
|
|
|
public function __invoke(Data $payload, Closure $next)
|
|
{
|
|
$this->createBalanceCommand->execute($payload->balanceDTO->except('amount', 'type')->toArray());
|
|
|
|
return $next($payload);
|
|
}
|
|
}
|