2023-10-11 07:55:05 +00:00
|
|
|
<?php
|
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
namespace App\Livewire\Subscription;
|
2023-10-11 07:55:05 +00:00
|
|
|
|
|
|
|
use App\Models\InstanceSettings;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class Show extends Component
|
|
|
|
{
|
|
|
|
public InstanceSettings $settings;
|
|
|
|
public bool $alreadySubscribed = false;
|
|
|
|
public function mount() {
|
|
|
|
if (!isCloud()) {
|
2023-12-07 21:56:55 +00:00
|
|
|
return $this->redirect('/', navigate: true);
|
2023-10-11 07:55:05 +00:00
|
|
|
}
|
|
|
|
$this->settings = InstanceSettings::get();
|
|
|
|
$this->alreadySubscribed = currentTeam()->subscription()->exists();
|
|
|
|
}
|
|
|
|
public function stripeCustomerPortal() {
|
|
|
|
$session = getStripeCustomerPortalSession(currentTeam());
|
|
|
|
if (is_null($session)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return redirect($session->url);
|
|
|
|
}
|
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
return view('livewire.subscription.show')->layout('layouts.subscription');
|
|
|
|
}
|
|
|
|
}
|