Files
MKM/app/Actions/Ledgers/CreateLedgerAction.php
2024-08-15 20:11:21 +08:00

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);
}
}