fix: subscription / plan switch, etc
This commit is contained in:
parent
f931ebece8
commit
f78fd212bb
@ -10,14 +10,19 @@ class Index extends Component
|
|||||||
{
|
{
|
||||||
public InstanceSettings $settings;
|
public InstanceSettings $settings;
|
||||||
public bool $alreadySubscribed = false;
|
public bool $alreadySubscribed = false;
|
||||||
public function mount() {
|
public function mount()
|
||||||
|
{
|
||||||
if (!isCloud()) {
|
if (!isCloud()) {
|
||||||
return redirect(RouteServiceProvider::HOME);
|
return redirect(RouteServiceProvider::HOME);
|
||||||
}
|
}
|
||||||
|
if (data_get(currentTeam(), 'subscription')) {
|
||||||
|
return redirect()->route('subscription.show');
|
||||||
|
}
|
||||||
$this->settings = InstanceSettings::get();
|
$this->settings = InstanceSettings::get();
|
||||||
$this->alreadySubscribed = currentTeam()->subscription()->exists();
|
$this->alreadySubscribed = currentTeam()->subscription()->exists();
|
||||||
}
|
}
|
||||||
public function stripeCustomerPortal() {
|
public function stripeCustomerPortal()
|
||||||
|
{
|
||||||
$session = getStripeCustomerPortalSession(currentTeam());
|
$session = getStripeCustomerPortalSession(currentTeam());
|
||||||
if (is_null($session)) {
|
if (is_null($session)) {
|
||||||
return;
|
return;
|
||||||
|
@ -11,6 +11,9 @@ class Show extends Component
|
|||||||
if (!isCloud()) {
|
if (!isCloud()) {
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
|
if (!data_get(currentTeam(), 'subscription')) {
|
||||||
|
return redirect()->route('subscription.index');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
@ -30,8 +30,7 @@ class Subscription extends Model
|
|||||||
if (in_array($subscription, $ultimate)) {
|
if (in_array($subscription, $ultimate)) {
|
||||||
return 'ultimate';
|
return 'ultimate';
|
||||||
}
|
}
|
||||||
}
|
} else if (isStripe()) {
|
||||||
if (isStripe()) {
|
|
||||||
if (!$this->stripe_plan_id) {
|
if (!$this->stripe_plan_id) {
|
||||||
return 'zero';
|
return 'zero';
|
||||||
}
|
}
|
||||||
@ -55,7 +54,8 @@ class Subscription extends Model
|
|||||||
};
|
};
|
||||||
})->first();
|
})->first();
|
||||||
if ($stripePlanId) {
|
if ($stripePlanId) {
|
||||||
return Str::of($stripePlanId)->after('stripe_price_id_')->before('_')->lower();
|
raY($stripePlanId);
|
||||||
|
return str($stripePlanId)->after('stripe_price_id_')->before('_')->lower();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 'zero';
|
return 'zero';
|
||||||
|
@ -159,6 +159,9 @@ class User extends Authenticatable implements SendsEmail
|
|||||||
|
|
||||||
public function role()
|
public function role()
|
||||||
{
|
{
|
||||||
|
if (data_get($this, 'pivot')) {
|
||||||
|
return $this->pivot->role;
|
||||||
|
}
|
||||||
return auth()->user()->teams->where('id', currentTeam()->id)->first()->pivot->role;
|
return auth()->user()->teams->where('id', currentTeam()->id)->first()->pivot->role;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,12 @@ return [
|
|||||||
'stripe_price_id_ultimate_yearly' => env('STRIPE_PRICE_ID_ULTIMATE_YEARLY', null),
|
'stripe_price_id_ultimate_yearly' => env('STRIPE_PRICE_ID_ULTIMATE_YEARLY', null),
|
||||||
'stripe_excluded_plans' => env('STRIPE_EXCLUDED_PLANS', null),
|
'stripe_excluded_plans' => env('STRIPE_EXCLUDED_PLANS', null),
|
||||||
|
|
||||||
|
'stripe_price_id_basic_monthly_old' => env('STRIPE_PRICE_ID_BASIC_MONTHLY_OLD', null),
|
||||||
|
'stripe_price_id_basic_yearly_old' => env('STRIPE_PRICE_ID_BASIC_YEARLY_OLD', null),
|
||||||
|
'stripe_price_id_pro_monthly_old' => env('STRIPE_PRICE_ID_PRO_MONTHLY_OLD', null),
|
||||||
|
'stripe_price_id_pro_yearly_old' => env('STRIPE_PRICE_ID_PRO_YEARLY_OLD', null),
|
||||||
|
'stripe_price_id_ultimate_monthly_old' => env('STRIPE_PRICE_ID_ULTIMATE_MONTHLY_OLD', null),
|
||||||
|
'stripe_price_id_ultimate_yearly_old' => env('STRIPE_PRICE_ID_ULTIMATE_YEARLY_OLD', null),
|
||||||
|
|
||||||
// Paddle
|
// Paddle
|
||||||
'paddle_vendor_id' => env('PADDLE_VENDOR_ID', null),
|
'paddle_vendor_id' => env('PADDLE_VENDOR_ID', null),
|
||||||
|
@ -57,6 +57,12 @@ services:
|
|||||||
- STRIPE_PRICE_ID_PRO_YEARLY
|
- STRIPE_PRICE_ID_PRO_YEARLY
|
||||||
- STRIPE_PRICE_ID_ULTIMATE_MONTHLY
|
- STRIPE_PRICE_ID_ULTIMATE_MONTHLY
|
||||||
- STRIPE_PRICE_ID_ULTIMATE_YEARLY
|
- STRIPE_PRICE_ID_ULTIMATE_YEARLY
|
||||||
|
- STRIPE_PRICE_ID_BASIC_MONTHLY_OLD
|
||||||
|
- STRIPE_PRICE_ID_BASIC_YEARLY_OLD
|
||||||
|
- STRIPE_PRICE_ID_PRO_MONTHLY_OLD
|
||||||
|
- STRIPE_PRICE_ID_PRO_YEARLY_OLD
|
||||||
|
- STRIPE_PRICE_ID_ULTIMATE_MONTHLY_OLD
|
||||||
|
- STRIPE_PRICE_ID_ULTIMATE_YEARLY_OLD
|
||||||
- STRIPE_EXCLUDED_PLANS
|
- STRIPE_EXCLUDED_PLANS
|
||||||
- PADDLE_VENDOR_ID
|
- PADDLE_VENDOR_ID
|
||||||
- PADDLE_WEBHOOK_SECRET
|
- PADDLE_WEBHOOK_SECRET
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<h1>Dashboard</h1>
|
<h1>Dashboard</h1>
|
||||||
<div class="subtitle">Your self-hosted environment</div>
|
<div class="subtitle">Your self-hosted environment</div>
|
||||||
@if (request()->query->get('success'))
|
@if (request()->query->get('success'))
|
||||||
<div class="text-white rounded alert alert-success">
|
<div class="mb-10 text-white rounded alert alert-success">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none"
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none"
|
||||||
viewBox="0 0 24 24">
|
viewBox="0 0 24 24">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
@ -16,12 +16,11 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if ($projects->count() === 0 && $servers->count() === 0)
|
@if ($projects->count() === 0 && $servers->count() === 0)
|
||||||
No resources found. Add your first server / private key <a class="text-white underline"
|
No resources found. Add your first server & private key <a class="text-white underline"
|
||||||
href="{{ route('server.create') }}">here</a>.
|
href="{{ route('server.create') }}">here</a> or go to the <a class="text-white underline" href="{{ route('boarding') }}">boarding page</a>.
|
||||||
@endif
|
@endif
|
||||||
@if ($projects->count() > 0)
|
@if ($projects->count() > 0)
|
||||||
<h3 class="pb-4">Projects</h3>
|
<h3 class="pb-4">Projects</h3>
|
||||||
@endif
|
|
||||||
@if ($projects->count() === 1)
|
@if ($projects->count() === 1)
|
||||||
<div class="grid grid-cols-1 gap-2">
|
<div class="grid grid-cols-1 gap-2">
|
||||||
@else
|
@else
|
||||||
@ -139,6 +138,7 @@
|
|||||||
<div>No deployments running.</div>
|
<div>No deployments running.</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
<script>
|
<script>
|
||||||
function gotoProject(uuid, environment = 'production') {
|
function gotoProject(uuid, environment = 'production') {
|
||||||
window.location.href = '/project/' + uuid + '/' + environment;
|
window.location.href = '/project/' + uuid + '/' + environment;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
<path fill="#635BFF"
|
<path fill="#635BFF"
|
||||||
d="M512 110.08c0-36.409-17.636-65.138-51.342-65.138c-33.85 0-54.33 28.73-54.33 64.854c0 42.808 24.179 64.426 58.88 64.426c16.925 0 29.725-3.84 39.396-9.244v-28.445c-9.67 4.836-20.764 7.823-34.844 7.823c-13.796 0-26.027-4.836-27.591-21.618h69.547c0-1.85.284-9.245.284-12.658Zm-70.258-13.511c0-16.071 9.814-22.756 18.774-22.756c8.675 0 17.92 6.685 17.92 22.756h-36.694Zm-90.31-51.627c-13.939 0-22.899 6.542-27.876 11.094l-1.85-8.818h-31.288v165.83l35.555-7.537l.143-40.249c5.12 3.698 12.657 8.96 25.173 8.96c25.458 0 48.64-20.48 48.64-65.564c-.142-41.245-23.609-63.716-48.498-63.716Zm-8.534 97.991c-8.391 0-13.37-2.986-16.782-6.684l-.143-52.765c3.698-4.124 8.818-6.968 16.925-6.968c12.942 0 21.902 14.506 21.902 33.137c0 19.058-8.818 33.28-21.902 33.28ZM241.493 36.551l35.698-7.68V0l-35.698 7.538V36.55Zm0 10.809h35.698v124.444h-35.698V47.36Zm-38.257 10.524L200.96 47.36h-30.72v124.444h35.556V87.467c8.39-10.951 22.613-8.96 27.022-7.396V47.36c-4.551-1.707-21.191-4.836-29.582 10.524Zm-71.112-41.386l-34.702 7.395l-.142 113.92c0 21.05 15.787 36.551 36.836 36.551c11.662 0 20.195-2.133 24.888-4.693V140.8c-4.55 1.849-27.022 8.391-27.022-12.658V77.653h27.022V47.36h-27.022l.142-30.862ZM35.982 83.484c0-5.546 4.551-7.68 12.09-7.68c10.808 0 24.461 3.272 35.27 9.103V51.484c-11.804-4.693-23.466-6.542-35.27-6.542C19.2 44.942 0 60.018 0 85.192c0 39.252 54.044 32.995 54.044 49.92c0 6.541-5.688 8.675-13.653 8.675c-11.804 0-26.88-4.836-38.827-11.378v33.849c13.227 5.689 26.596 8.106 38.827 8.106c29.582 0 49.92-14.648 49.92-40.106c-.142-42.382-54.329-34.845-54.329-50.774Z" />
|
d="M512 110.08c0-36.409-17.636-65.138-51.342-65.138c-33.85 0-54.33 28.73-54.33 64.854c0 42.808 24.179 64.426 58.88 64.426c16.925 0 29.725-3.84 39.396-9.244v-28.445c-9.67 4.836-20.764 7.823-34.844 7.823c-13.796 0-26.027-4.836-27.591-21.618h69.547c0-1.85.284-9.245.284-12.658Zm-70.258-13.511c0-16.071 9.814-22.756 18.774-22.756c8.675 0 17.92 6.685 17.92 22.756h-36.694Zm-90.31-51.627c-13.939 0-22.899 6.542-27.876 11.094l-1.85-8.818h-31.288v165.83l35.555-7.537l.143-40.249c5.12 3.698 12.657 8.96 25.173 8.96c25.458 0 48.64-20.48 48.64-65.564c-.142-41.245-23.609-63.716-48.498-63.716Zm-8.534 97.991c-8.391 0-13.37-2.986-16.782-6.684l-.143-52.765c3.698-4.124 8.818-6.968 16.925-6.968c12.942 0 21.902 14.506 21.902 33.137c0 19.058-8.818 33.28-21.902 33.28ZM241.493 36.551l35.698-7.68V0l-35.698 7.538V36.55Zm0 10.809h35.698v124.444h-35.698V47.36Zm-38.257 10.524L200.96 47.36h-30.72v124.444h35.556V87.467c8.39-10.951 22.613-8.96 27.022-7.396V47.36c-4.551-1.707-21.191-4.836-29.582 10.524Zm-71.112-41.386l-34.702 7.395l-.142 113.92c0 21.05 15.787 36.551 36.836 36.551c11.662 0 20.195-2.133 24.888-4.693V140.8c-4.55 1.849-27.022 8.391-27.022-12.658V77.653h27.022V47.36h-27.022l.142-30.862ZM35.982 83.484c0-5.546 4.551-7.68 12.09-7.68c10.808 0 24.461 3.272 35.27 9.103V51.484c-11.804-4.693-23.466-6.542-35.27-6.542C19.2 44.942 0 60.018 0 85.192c0 39.252 54.044 32.995 54.044 49.92c0 6.541-5.688 8.675-13.653 8.675c-11.804 0-26.88-4.836-38.827-11.378v33.849c13.227 5.689 26.596 8.106 38.827 8.106c29.582 0 49.92-14.648 49.92-40.106c-.142-42.382-54.329-34.845-54.329-50.774Z" />
|
||||||
</svg></x-forms.button>
|
</svg></x-forms.button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-4">
|
<div class="pt-4">
|
||||||
|
@ -3,14 +3,5 @@
|
|||||||
<h1>Subscription</h1>
|
<h1>Subscription</h1>
|
||||||
<div>Here you can see and manage your subscription.</div>
|
<div>Here you can see and manage your subscription.</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pb-8">
|
|
||||||
@if (data_get(currentTeam(), 'subscription'))
|
|
||||||
<livewire:subscription.actions />
|
<livewire:subscription.actions />
|
||||||
@else
|
|
||||||
<div>You are not subscribed to any plan. Please subscribe to a plan to continue.</div>
|
|
||||||
<x-forms.button class="mt-4"><a class="text-white hover:no-underline"
|
|
||||||
href="{{ route('subscription.index') }}">Subscribe Now</a>
|
|
||||||
</x-forms.button>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,8 +111,8 @@ Route::middleware(['auth', 'verified'])->group(function () {
|
|||||||
Route::get('/', Dashboard::class)->name('dashboard');
|
Route::get('/', Dashboard::class)->name('dashboard');
|
||||||
Route::get('/boarding', BoardingIndex::class)->name('boarding');
|
Route::get('/boarding', BoardingIndex::class)->name('boarding');
|
||||||
|
|
||||||
Route::get('/subscription/new', SubscriptionIndex::class)->name('subscription.index');
|
|
||||||
Route::get('/subscription', SubscriptionShow::class)->name('subscription.show');
|
Route::get('/subscription', SubscriptionShow::class)->name('subscription.show');
|
||||||
|
Route::get('/subscription/new', SubscriptionIndex::class)->name('subscription.index');
|
||||||
|
|
||||||
Route::get('/settings', SettingsIndex::class)->name('settings.index');
|
Route::get('/settings', SettingsIndex::class)->name('settings.index');
|
||||||
Route::get('/settings/license', SettingsLicense::class)->name('settings.license');
|
Route::get('/settings/license', SettingsLicense::class)->name('settings.license');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user