diff --git a/app/Http/Controllers/ClientPortal/PaymentMethodController.php b/app/Http/Controllers/ClientPortal/PaymentMethodController.php index b8b0441679..5d131daad7 100644 --- a/app/Http/Controllers/ClientPortal/PaymentMethodController.php +++ b/app/Http/Controllers/ClientPortal/PaymentMethodController.php @@ -144,7 +144,10 @@ class PaymentMethodController extends Controller try { event(new MethodDeleted($payment_method, auth()->guard('contact')->user()->company, Ninja::eventVars(auth()->guard('contact')->user()->id))); + $payment_method->is_deleted = true; $payment_method->delete(); + $payment_method->save(); + } catch (Exception $e) { nlog($e->getMessage()); diff --git a/app/Repositories/TaskRepository.php b/app/Repositories/TaskRepository.php index f003d4f7a1..426b2e5ed8 100644 --- a/app/Repositories/TaskRepository.php +++ b/app/Repositories/TaskRepository.php @@ -141,7 +141,7 @@ class TaskRepository extends BaseRepository { if(isset($time_log[0][0])) { - return \Carbon\Carbon::createFromTimestamp($time_log[0][0])->addSeconds($task->company->utc_offset()); + return \Carbon\Carbon::createFromTimestamp($time_log[0][0]); } return null; diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 1ba0846199..1c65aa6999 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -323,13 +323,22 @@ class AutoBillInvoice extends AbstractService public function getGateway($amount) { //get all client gateway tokens and set the is_default one to the first record - $gateway_tokens = $this->client - ->gateway_tokens() - ->whereHas('gateway', function ($query) { - $query->where('is_deleted', 0) - ->where('deleted_at', null); - })->orderBy('is_default', 'DESC') - ->get(); + $gateway_tokens = \App\Models\ClientGatewayToken::query() + ->where('client_id', $this->client->id) + ->where('is_deleted', 0) + ->whereHas('gateway', function ($query) { + $query->where('is_deleted', 0) + ->where('deleted_at', null); + })->orderBy('is_default', 'DESC') + ->get(); + + // $gateway_tokens = $this->client + // ->gateway_tokens() + // ->whereHas('gateway', function ($query) { + // $query->where('is_deleted', 0) + // ->where('deleted_at', null); + // })->orderBy('is_default', 'DESC') + // ->get(); $filtered_gateways = $gateway_tokens->filter(function ($gateway_token) use ($amount) { $company_gateway = $gateway_token->gateway;