getFormDataMutation($data); } public function getFormDataMutation(array $data): array { return Arr::except($data, ['client', 'transactions']); } protected function afterCreate(): void { $transactions = $this->form->getState()['transactions'] ?? []; try { $branch = $this->getRecord()->branch; foreach ($transactions as $transaction) { $data = [ 'branch_id' => $branch->id, 'happened_on' => $this->getRecord()->happened_on, ...$transaction, ]; $payload = new CreateTransactionDTO(data: $data, transactionable: $this->getRecord()); Pipeline::send(passable: $payload)->through( [ CreateTransactionAction::class, ] )->thenReturn(); } $this->commitDatabaseTransaction(); } catch (Exception $exception) { $this->rollBackDatabaseTransaction(); throw new LogicException('Failed to save transactions : '.$exception->getMessage()); } } }