Various improvs to the report generator.

This commit is contained in:
James Cole
2021-10-30 11:42:35 +02:00
parent a16b6cb2b8
commit 8b81526e54
8 changed files with 177 additions and 17 deletions

View File

@@ -41,15 +41,13 @@ trait ValidatesBulkTransactionQuery
protected function validateTransactionQuery(Validator $validator): void
{
$data = $validator->getData();
// assumption is all validation has already taken place
// and the query key exists.
// assumption is all validation has already taken place and the query key exists.
$json = json_decode($data['query'], true, 8, JSON_THROW_ON_ERROR);
if (array_key_exists('account_id', $json['where'])
&& array_key_exists('account_id', $json['update'])
) {
// find both accounts
// must be same type.
// find both accounts, must be same type.
// already validated: belongs to this user.
$repository = app(AccountRepositoryInterface::class);
$source = $repository->find((int)$json['where']['account_id']);