feat: updates

This commit is contained in:
JP
2024-08-15 20:11:21 +08:00
parent 52431a2c61
commit 3af7207ec3
61 changed files with 1674 additions and 480 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Commands\Ledgers;
use App\Commands\Command;
use App\Models\Ledger;
use Illuminate\Support\Facades\DB;
class CreateLedgerCommand implements Command
{
public function execute(array $data): mixed
{
return DB::transaction(function () use ($data) {
return Ledger::query()->updateOrCreate([
'id' => $data['id'] ?? null,
'transaction_id' => $data['transaction_id'] ?? null,
'account_id' => $data['account_id'] ?? null,
], [
'credit_amount' => $data['credit_amount'] ?? null,
'debit_amount' => $data['debit_amount'] ?? null,
'description' => $data['description'] ?? null,
'branch_id' => $data['branch_id'] ?? null,
'client_id' => $data['client_id'] ?? null,
]);
}, attempts: 2);
}
}