24 lines
532 B
PHP
24 lines
532 B
PHP
<?php
|
|
|
|
namespace App\Actions\Ledgers;
|
|
|
|
use App\Actions\BaseAction;
|
|
use App\Commands\Ledgers\CreateLedgerCommand;
|
|
use App\DataObjects\CreateLedgerDTO;
|
|
use Closure;
|
|
use Spatie\LaravelData\Data;
|
|
|
|
class CreateLedgerAction extends BaseAction
|
|
{
|
|
public function __construct(
|
|
private readonly CreateLedgerCommand $createLedgerCommand,
|
|
) {}
|
|
|
|
public function __invoke(CreateLedgerDTO|Data $payload, Closure $next)
|
|
{
|
|
$this->createLedgerCommand->execute($payload->data);
|
|
|
|
return $next($payload);
|
|
}
|
|
}
|