v2 first commit
This commit is contained in:
40
app/Jobs/Banking/DeleteReconciliation.php
Normal file
40
app/Jobs/Banking/DeleteReconciliation.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Banking;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Models\Banking\Transaction;
|
||||
|
||||
class DeleteReconciliation extends Job
|
||||
{
|
||||
protected $reconciliation;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param $reconciliation
|
||||
*/
|
||||
public function __construct($reconciliation)
|
||||
{
|
||||
$this->reconciliation = $reconciliation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return boolean|Exception
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->reconciliation->delete();
|
||||
|
||||
Transaction::where('account_id', $this->reconciliation->account_id)
|
||||
->reconciled()
|
||||
->whereBetween('paid_at', [$this->reconciliation->started_at, $this->reconciliation->ended_at])->each(function ($transaction) {
|
||||
$transaction->reconciled = 0;
|
||||
$transaction->save();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user