added pointer interfaces for jobs
This commit is contained in:
@@ -3,40 +3,20 @@
|
||||
namespace App\Jobs\Banking;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Interfaces\Job\ShouldUpdate;
|
||||
use App\Models\Banking\Reconciliation;
|
||||
use App\Models\Banking\Transaction;
|
||||
|
||||
class UpdateReconciliation extends Job
|
||||
class UpdateReconciliation extends Job implements ShouldUpdate
|
||||
{
|
||||
protected $reconciliation;
|
||||
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param $reconciliation
|
||||
* @param $request
|
||||
*/
|
||||
public function __construct($reconciliation, $request)
|
||||
{
|
||||
$this->reconciliation = $reconciliation;
|
||||
$this->request = $this->getRequestInstance($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return Reconciliation
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): Reconciliation
|
||||
{
|
||||
\DB::transaction(function () {
|
||||
$reconcile = (int) $this->request->get('reconcile');
|
||||
$transactions = $this->request->get('transactions');
|
||||
|
||||
$this->reconciliation->reconciled = $reconcile;
|
||||
$this->reconciliation->save();
|
||||
$this->model->reconciled = $reconcile;
|
||||
$this->model->save();
|
||||
|
||||
if ($transactions) {
|
||||
foreach ($transactions as $key => $value) {
|
||||
@@ -53,6 +33,6 @@ class UpdateReconciliation extends Job
|
||||
}
|
||||
});
|
||||
|
||||
return $this->reconciliation;
|
||||
return $this->model;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user