1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Http/Livewire/RecurringInvoiceCancellation.php
2023-01-29 09:21:40 +11:00

47 lines
1.1 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Livewire;
use App\Libraries\MultiDB;
use App\Models\RecurringInvoice;
use Livewire\Component;
class RecurringInvoiceCancellation extends Component
{
/**
* @var RecurringInvoice
*/
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) {
return $this->invoice->subscription->service()->handleCancellation($this->invoice);
}
return redirect()->route('client.recurring_invoices.request_cancellation', ['recurring_invoice' => $this->invoice->hashed_id]);
}
}