CaiWuXiTong/app/Jobs/Banking/DeleteReconciliation.php
WuYongJie 9595267ee7
Some checks failed
Tests / PHP 8.1 (push) Has been cancelled
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
chore: 导入 Akaunting 初始源码与团队协作规则
2026-07-20 18:20:25 +08:00

27 lines
699 B
PHP

<?php
namespace App\Jobs\Banking;
use App\Abstracts\Job;
use App\Interfaces\Job\ShouldDelete;
use App\Models\Banking\Transaction;
class DeleteReconciliation extends Job implements ShouldDelete
{
public function handle(): bool
{
\DB::transaction(function () {
$this->model->delete();
Transaction::where('account_id', $this->model->account_id)
->isReconciled()
->whereBetween('paid_at', [$this->model->started_at, $this->model->ended_at])->each(function ($transaction) {
$transaction->reconciled = 0;
$transaction->save();
});
});
return true;
}
}