lasthourcloud/app/Livewire/Subscription/Index.php

32 lines
861 B
PHP
Raw Normal View History

<?php
2023-12-07 18:06:32 +00:00
namespace App\Livewire\Subscription;
use App\Models\InstanceSettings;
2023-12-27 15:45:01 +00:00
use App\Providers\RouteServiceProvider;
use Livewire\Component;
2024-01-07 15:23:41 +00:00
class Index extends Component
{
public InstanceSettings $settings;
public bool $alreadySubscribed = false;
public function mount() {
if (!isCloud()) {
2023-12-27 15:45:01 +00:00
return redirect(RouteServiceProvider::HOME);
}
$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()
{
2024-01-07 15:23:41 +00:00
return view('livewire.subscription.index')->layout('layouts.subscription');
}
}