����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 3.15.3.240 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/cbt.bofirm.com/app/Repositories/ |
Upload File : |
<?php /** * File name: PaymentRepository.php * Last modified: 02/02/22, 1:51 PM * Author: NearCraft - https://codecanyon.net/user/nearcraft * Copyright (c) 2022 */ namespace App\Repositories; use App\Models\Payment; use App\Models\Subscription; use App\Settings\BillingSettings; use Carbon\Carbon; use Illuminate\Support\Str; class PaymentRepository { /** * Store Payment * * @param $data * @return Payment */ public function createPayment($data) { $billingSettings = app(BillingSettings::class); $payment = new Payment(); $payment->payment_id = $data['payment_id']; $payment->currency = $data['currency']; $payment->plan_id = $data['plan_id']; $payment->user_id = $data['user_id']; $payment->total_amount = $data['total_amount']; $payment->payment_date = $data['payment_date']; $payment->payment_processor = $data['payment_processor']; $payment->transaction_id = $data['transaction_id'] ?? null; $payment->reference_id = $data['reference_id'] ?? null; $payment->status = $data['status']; $payment->data = [ 'vendor_billing_information' => $billingSettings->toArray(), 'customer_billing_information' => $data['billing_information'], 'order_summary' => $data['order_summary'] ]; $payment->save(); $payment->invoice_id = $billingSettings->invoice_prefix.'-'.Str::padLeft($payment->id, 5, '0'); $payment->update(); return $payment; } public function createSubscription($data) { $subscription = new Subscription(); $subscription->plan_id = $data['plan_id']; $subscription->payment_id = $data['payment_id']; $subscription->user_id = $data['user_id']; $subscription->category_type = $data['category_type']; $subscription->category_id = $data['category_id']; $subscription->starts_at = Carbon::now()->toDateTimeString(); $subscription->ends_at = Carbon::now()->addMonths($data['duration'])->toDateTimeString(); $subscription->status = $data['status']; $subscription->save(); return $subscription; } }