From 8b3c579f7b3435a65ad50eb3e1744877fd1a60ba Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 27 Nov 2022 19:03:28 +1100 Subject: [PATCH] Wind back Middleware for Bank Service Matching --- app/Services/Bank/BankMatchingService.php | 32 ++++++----------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index 4cdb3415c6af..ca95cd9a4427 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -31,32 +31,16 @@ use Illuminate\Support\Facades\Cache; class BankMatchingService implements ShouldQueue { - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, GeneratesCounter; - - private Company $company; - - private $invoices; - - public $deleteWhenMissingModels = true; + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public function __construct(private int $company_id, private string $db){} - public function handle() + public function handle() :void { MultiDB::setDb($this->db); - $this->company = Company::find($this->company_id); - - $this->matchTransactions(); - - - } - - private function matchTransactions() - { - - BankTransaction::where('company_id', $this->company->id) + BankTransaction::where('company_id', $this->company_id) ->where('status_id', BankTransaction::STATUS_UNMATCHED) ->cursor() ->each(function ($bt){ @@ -64,11 +48,11 @@ class BankMatchingService implements ShouldQueue (new BankService($bt))->processRules(); }); - + } - public function middleware() - { - return [new WithoutOverlapping($this->company_id)]; - } + // public function middleware() + // { + // return [new WithoutOverlapping($this->company_id)]; + // } }