diff --git a/app/Http/Livewire/CreditsTable.php b/app/Http/Livewire/CreditsTable.php index 4ea703c2db5b..3d8713e0b77a 100644 --- a/app/Http/Livewire/CreditsTable.php +++ b/app/Http/Livewire/CreditsTable.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\Credit; use App\Utils\Traits\WithSorting; use Livewire\Component; @@ -24,6 +25,13 @@ class CreditsTable extends Component public $per_page = 10; + public $company; + + public function mount() + { + MultiDB::setDb($this->company->db); + } + public function render() { $query = Credit::query() diff --git a/app/Http/Livewire/DocumentsTable.php b/app/Http/Livewire/DocumentsTable.php index 465effc98493..f71cf116a4ca 100644 --- a/app/Http/Livewire/DocumentsTable.php +++ b/app/Http/Livewire/DocumentsTable.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\Client; use App\Utils\Traits\WithSorting; use Livewire\Component; @@ -25,8 +26,13 @@ class DocumentsTable extends Component public $per_page = 10; + public $company; + public function mount($client) { + + MultiDB::setDb($this->company->db); + $this->client = $client; } diff --git a/app/Http/Livewire/InvoicesTable.php b/app/Http/Livewire/InvoicesTable.php index 783c832df58a..2659f1fdd0e4 100644 --- a/app/Http/Livewire/InvoicesTable.php +++ b/app/Http/Livewire/InvoicesTable.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\Invoice; use App\Utils\Traits\WithSorting; use Carbon\Carbon; @@ -26,8 +27,12 @@ class InvoicesTable extends Component public $status = []; + public $company; + public function mount() { + MultiDB::setDb($this->company->db); + $this->sort_asc = false; $this->sort_field = 'date'; diff --git a/app/Http/Livewire/PayNowDropdown.php b/app/Http/Livewire/PayNowDropdown.php index 440872077fa7..8ca1dfc77dc5 100644 --- a/app/Http/Livewire/PayNowDropdown.php +++ b/app/Http/Livewire/PayNowDropdown.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use Livewire\Component; class PayNowDropdown extends Component @@ -20,8 +21,12 @@ class PayNowDropdown extends Component public $methods; + public $company; + public function mount(int $total) { + MultiDB::setDb($this->company->db); + $this->total = $total; $this->methods = auth()->user()->client->service()->getPaymentMethods($total); diff --git a/app/Http/Livewire/PaymentMethodsTable.php b/app/Http/Livewire/PaymentMethodsTable.php index 3a6d9d14a7a5..8a37e715374e 100644 --- a/app/Http/Livewire/PaymentMethodsTable.php +++ b/app/Http/Livewire/PaymentMethodsTable.php @@ -5,6 +5,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\ClientGatewayToken; use App\Utils\Traits\WithSorting; use Livewire\Component; @@ -16,10 +17,16 @@ class PaymentMethodsTable extends Component use WithSorting; public $per_page = 10; + public $client; + public $company; + public function mount($client) { + + MultiDB::setDb($this->company->db); + $this->client = $client; } diff --git a/app/Http/Livewire/PaymentsTable.php b/app/Http/Livewire/PaymentsTable.php index 0a41f98d4dd8..f9bd5991bd3a 100644 --- a/app/Http/Livewire/PaymentsTable.php +++ b/app/Http/Livewire/PaymentsTable.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\Payment; use App\Utils\Traits\WithSorting; use Livewire\Component; @@ -23,11 +24,17 @@ class PaymentsTable extends Component use WithPagination; public $per_page = 10; + public $user; + public $company; + public function mount() { + MultiDB::setDb($this->company->db); + $this->user = auth()->user(); + } public function render() diff --git a/app/Http/Livewire/QuotesTable.php b/app/Http/Livewire/QuotesTable.php index c14847eccd98..f697c965bfd3 100644 --- a/app/Http/Livewire/QuotesTable.php +++ b/app/Http/Livewire/QuotesTable.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\Quote; use App\Utils\Traits\WithSorting; use Livewire\Component; @@ -23,8 +24,17 @@ class QuotesTable extends Component use WithPagination; public $per_page = 10; + public $status = []; + public $company; + + public function mount() + { + MultiDB::setDb($this->company->db); + + } + public function render() { $query = Quote::query() diff --git a/app/Http/Livewire/RecurringInvoiceCancellation.php b/app/Http/Livewire/RecurringInvoiceCancellation.php index d3904c874330..06ade750d9ae 100644 --- a/app/Http/Livewire/RecurringInvoiceCancellation.php +++ b/app/Http/Livewire/RecurringInvoiceCancellation.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\RecurringInvoice; use Livewire\Component; @@ -22,6 +23,18 @@ class RecurringInvoiceCancellation extends Component */ public $invoice; + public $company; + + public function mount() + { + MultiDB::setDb($this->company->db); + } + + public function render() + { + return render('components.livewire.recurring-invoice-cancellation'); + } + public function processCancellation() { if ($this->invoice->subscription) { @@ -31,8 +44,5 @@ class RecurringInvoiceCancellation extends Component return redirect()->route('client.recurring_invoices.request_cancellation', ['recurring_invoice' => $this->invoice->hashed_id]); } - public function render() - { - return render('components.livewire.recurring-invoice-cancellation'); - } + } diff --git a/app/Http/Livewire/RequiredClientInfo.php b/app/Http/Livewire/RequiredClientInfo.php index 2b51cacbb841..6c00e8d3ea14 100644 --- a/app/Http/Livewire/RequiredClientInfo.php +++ b/app/Http/Livewire/RequiredClientInfo.php @@ -13,6 +13,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\ClientContact; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Str; @@ -65,7 +66,12 @@ class RequiredClientInfo extends Component public $show_form = false; - public function mount() {} + public $company; + + public function mount() + { + MultiDB::setDb($this->company->db); + } public function handleSubmit(array $data): bool { diff --git a/app/Http/Livewire/SubscriptionPlanSwitch.php b/app/Http/Livewire/SubscriptionPlanSwitch.php index 9ad9f35dc672..3454e38330a9 100644 --- a/app/Http/Livewire/SubscriptionPlanSwitch.php +++ b/app/Http/Livewire/SubscriptionPlanSwitch.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\ClientContact; use App\Models\Subscription; use Illuminate\Support\Facades\Cache; @@ -71,8 +72,12 @@ class SubscriptionPlanSwitch extends Component */ public $hash; + public $company; + public function mount() { + MultiDB::setDb($this->company->db); + $this->total = $this->amount; $this->methods = $this->contact->client->service()->getPaymentMethods($this->amount); diff --git a/app/Http/Livewire/SubscriptionRecurringInvoicesTable.php b/app/Http/Livewire/SubscriptionRecurringInvoicesTable.php index f5c0947593ae..59ef4d028005 100644 --- a/app/Http/Livewire/SubscriptionRecurringInvoicesTable.php +++ b/app/Http/Livewire/SubscriptionRecurringInvoicesTable.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\RecurringInvoice; use App\Utils\Traits\WithSorting; use Livewire\Component; @@ -24,6 +25,13 @@ class SubscriptionRecurringInvoicesTable extends Component public $per_page = 10; + public $company; + + public function mount() + { + MultiDB::setDb($this->company->db); + } + public function render() { $query = RecurringInvoice::query() diff --git a/app/Http/Livewire/TasksTable.php b/app/Http/Livewire/TasksTable.php index 9a741ed49dd7..9881ba377253 100644 --- a/app/Http/Livewire/TasksTable.php +++ b/app/Http/Livewire/TasksTable.php @@ -12,6 +12,7 @@ namespace App\Http\Livewire; +use App\Libraries\MultiDB; use App\Models\Task; use App\Utils\Traits\WithSorting; use Livewire\Component; @@ -24,6 +25,13 @@ class TasksTable extends Component public $per_page = 10; + public $company; + + public function mount() + { + MultiDB::setDb($this->company->db); + } + public function render() { $query = Task::query() diff --git a/resources/views/portal/ninja2020/credits/index.blade.php b/resources/views/portal/ninja2020/credits/index.blade.php index d75caf6ab950..b485339c7a2e 100644 --- a/resources/views/portal/ninja2020/credits/index.blade.php +++ b/resources/views/portal/ninja2020/credits/index.blade.php @@ -13,6 +13,6 @@ @section('body')