An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
refactor + fixes
Andras Bacsai5b6667c46121
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.phpindex e3d8420ab8..a929296076 100644--- a/app/Http/Controllers/Controller.php+++ b/app/Http/Controllers/Controller.php@@ -30,7 +30,7 @@ class Controller extends BaseControllerif (!is_cloud()) {abort(404);}- return view('subscription.show', [+ return view('subscription.index', ['settings' => InstanceSettings::get(),]);}@@ -80,7 +80,7 @@ class Controller extends BaseControllerif (auth()->user()->isAdminFromSession()) {$invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();}- return view('team.show', [+ return view('team.index', ['invitations' => $invitations,]);}@@ -129,7 +129,7 @@ class Controller extends BaseControllerif ($diff <= config('constants.invitation.link.expiration')) {$user->teams()->attach($invitation->team->id, ['role' => $invitation->role]);$invitation->delete();- return redirect()->route('team.show');+ return redirect()->route('team.index');} else {$invitation->delete();abort(401);@@ -151,7 +151,7 @@ class Controller extends BaseControllerabort(401);}$invitation->delete();- return redirect()->route('team.show');+ return redirect()->route('team.index');} catch (Throwable $th) {throw $th;}diff --git a/app/Http/Kernel.php b/app/Http/Kernel.phpindex eb93b6d356..be63b9694f 100644--- a/app/Http/Kernel.php+++ b/app/Http/Kernel.php@@ -38,7 +38,7 @@ class Kernel extends HttpKernel\App\Http\Middleware\VerifyCsrfToken::class,\Illuminate\Routing\Middleware\SubstituteBindings::class,\App\Http\Middleware\CheckForcePasswordReset::class,- \App\Http\Middleware\SubscriptionValid::class,+ \App\Http\Middleware\IsSubscriptionValid::class,\App\Http\Middleware\IsBoardingFlow::class,],diff --git a/app/Http/Livewire/Subscription/PricingPlans.php b/app/Http/Livewire/Subscription/PricingPlans.phpindex fcf24237fd..cc43599bb1 100644--- a/app/Http/Livewire/Subscription/PricingPlans.php+++ b/app/Http/Livewire/Subscription/PricingPlans.php@@ -49,7 +49,7 @@ class PricingPlans extends Component],'mode' => 'subscription','success_url' => route('subscription.success'),- 'cancel_url' => route('subscription.show',['cancelled' => true]),+ 'cancel_url' => route('subscription.index',['cancelled' => true]),];$customer = currentTeam()->subscription?->stripe_customer_id ?? null;if ($customer) {diff --git a/app/Http/Livewire/Team/Create.php b/app/Http/Livewire/Team/Create.phpindex bd2c243134..0e721814c8 100644--- a/app/Http/Livewire/Team/Create.php+++ b/app/Http/Livewire/Team/Create.php@@ -30,7 +30,7 @@ class Create extends Component]);auth()->user()->teams()->attach($team, ['role' => 'admin']);refreshSession();- return redirect()->route('team.show');+ return redirect()->route('team.index');} catch (\Throwable $th) {return general_error_handler($th, $this);}diff --git a/app/Http/Livewire/Team/Delete.php b/app/Http/Livewire/Team/Delete.phpindex 5e206704b8..32e386ebc2 100644--- a/app/Http/Livewire/Team/Delete.php+++ b/app/Http/Livewire/Team/Delete.php@@ -25,6 +25,6 @@ class Delete extends Component});refreshSession();- return redirect()->route('team.show');+ return redirect()->route('team.index');}}diff --git a/app/Http/Livewire/Team/Form.php b/app/Http/Livewire/Team/Form.phpindex caa6d2c9ea..16aff27ee9 100644--- a/app/Http/Livewire/Team/Form.php+++ b/app/Http/Livewire/Team/Form.php@@ -28,7 +28,6 @@ class Form extends Componenttry {$this->team->save();refreshSession();- $this->emit('reloadWindow');} catch (\Throwable $th) {return general_error_handler($th, $this);}diff --git a/app/Http/Middleware/SubscriptionValid.php b/app/Http/Middleware/IsSubscriptionValid.phpsimilarity index 97%rename from app/Http/Middleware/SubscriptionValid.phprename to app/Http/Middleware/IsSubscriptionValid.phpindex 824133f5ad..01fa7a8d06 100644--- a/app/Http/Middleware/SubscriptionValid.php+++ b/app/Http/Middleware/IsSubscriptionValid.php@@ -6,7 +6,7 @@ use Closure;use Illuminate\Http\Request;use Symfony\Component\HttpFoundation\Response;-class SubscriptionValid+class IsSubscriptionValid{public function handle(Request $request, Closure $next): Response{diff --git a/app/Models/User.php b/app/Models/User.phpindex ccbfd14df2..ca3cf0bd3b 100644--- a/app/Models/User.php+++ b/app/Models/User.php@@ -32,6 +32,7 @@ class User extends Authenticatable implements SendsEmail$team = ['name' => $user->name . "'s Team",'personal_team' => true,+ 'boarding' => true];if ($user->id === 0) {$team['id'] = 0;diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex da8eaebdff..96a798cdf5 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -53,7 +53,8 @@ function showBoarding(): bool}function refreshSession(): void{- session(['currentTeam' => currentTeam()]);+ $team = Team::find(currentTeam()->id);+ session(['currentTeam' => $team]);}function general_error_handler(Throwable | null $err = null, $that = null, $isJson = false, $customErrorMessage = null): mixed{diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.phpindex ab266da2c1..ce58d17901 100644--- a/bootstrap/helpers/subscriptions.php+++ b/bootstrap/helpers/subscriptions.php@@ -70,7 +70,6 @@ function isSubscriptionActive()}function isSubscriptionOnGracePeriod(){-$team = currentTeam();if (!$team) {return false;@@ -96,7 +95,7 @@ function subscriptionProvider()function getStripeCustomerPortalSession(Team $team){Stripe::setApiKey(config('subscription.stripe_api_key'));- $return_url = route('team.show');+ $return_url = route('team.index');$stripe_customer_id = $team->subscription->stripe_customer_id;$session = \Stripe\BillingPortal\Session::create(['customer' => $stripe_customer_id,diff --git a/config/constants.php b/config/constants.phpindex 6cb4552656..be7710e6b5 100644--- a/config/constants.php+++ b/config/constants.php@@ -12,8 +12,8 @@ return ['limits' => ['server' => ['basic' => 1,- 'pro' => 3,- 'ultimate' => 9999999999999999999,+ 'pro' => 10,+ 'ultimate' => 25,],],];diff --git a/resources/views/components/limit-reached.blade.php b/resources/views/components/limit-reached.blade.phpindex c2c4b4b0e8..6b0f6f2adb 100644--- a/resources/views/components/limit-reached.blade.php+++ b/resources/views/components/limit-reached.blade.php@@ -1,6 +1,6 @@<div class="flex flex-col items-center justify-center h-screen"><span class="text-xl font-bold text-white">You have reached the limit of {{ $name }} you can create.</span>- <span>Please <a class="text-white underline "href="{{ route('team.show') }}">upgrade your+ <span>Please <a class="text-white underline "href="{{ route('team.index') }}">upgrade yoursubscription<a /> to create more{{ $name }}.</span></div>diff --git a/resources/views/components/navbar-subscription.blade.php b/resources/views/components/navbar-subscription.blade.phpindex 08248e61eb..73e67410b4 100644--- a/resources/views/components/navbar-subscription.blade.php+++ b/resources/views/components/navbar-subscription.blade.php@@ -1,6 +1,15 @@@auth<nav class="fixed h-full overflow-hidden overflow-y-auto scrollbar"><ul class="flex flex-col h-full gap-4 menu flex-nowrap">+ <li title="Dashboard">+ <a class="hover:bg-transparent" @if (!request()->is('/')) href="/" @endif>+ <svg xmlns="http://www.w3.org/2000/svg" class="{{ request()->is('/') ? 'text-warning icon' : 'icon' }}"+ fill="none" viewBox="0 0 24 24" stroke="currentColor">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"+ d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />+ </svg>+ </a>+ </li><li class="pb-6" title="Logout"><form action="/logout" method="POST" class=" hover:bg-transparent">@csrfdiff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.phpindex 6ce5808374..c4b3effcaa 100644--- a/resources/views/components/navbar.blade.php+++ b/resources/views/components/navbar.blade.php@@ -51,7 +51,7 @@</a></li><li title="Teams">- <a class="hover:bg-transparent" href="{{ route('team.show') }}">+ <a class="hover:bg-transparent" href="{{ route('team.index') }}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5"stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" />diff --git a/resources/views/components/pricing-plans.blade.php b/resources/views/components/pricing-plans.blade.phpindex acdc1653b2..95a9ee4d32 100644--- a/resources/views/components/pricing-plans.blade.php+++ b/resources/views/components/pricing-plans.blade.php@@ -3,21 +3,21 @@])<div x-data="{ selected: 'yearly' }" class="w-full pb-20"><div class="px-6 mx-auto lg:px-8">- <div class="flex justify-center mt-5">+ <div class="flex justify-center"><fieldset- class="grid grid-cols-2 p-1 text-xs font-semibold leading-5 text-center rounded-full gap-x-1 ">+ class="grid grid-cols-2 p-1 text-xs font-semibold leading-5 text-center text-white rounded gap-x-1 bg-white/5"><legend class="sr-only">Payment frequency</legend>- <label class="cursor-pointer rounded px-2.5 py-1"+ <label class="cursor-pointer rounded px-2.5 py-1":class="selected === 'monthly' ? 'bg-coollabs-100 text-white' : ''"><input type="radio" x-on:click="selected = 'monthly'" name="frequency" value="monthly"class="sr-only"><span>Monthly</span></label>- <label class="cursor-pointer rounded px-2.5 py-1"+ <label class="cursor-pointer rounded px-2.5 py-1":class="selected === 'yearly' ? 'bg-coollabs-100 text-white' : ''"><input type="radio" x-on:click="selected = 'yearly'" name="frequency" value="annually"class="sr-only">- <span>Annually <span class="text-xs text-warning">(save ~1 month)<span></span>+ <span>Annually</span></label></fieldset></div>@@ -167,9 +167,9 @@<span>billed annually</span></span>@if ($showSubscribeButtons)- @isset($pro)- {{ $pro }}- @endisset+ @isset($pro)+ {{ $pro }}+ @endisset@endif<p class="h-20 mt-10 text-sm leading-6 text-white">Scale your business or self-hosting environment.</p>@@ -181,7 +181,7 @@d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"clip-rule="evenodd" /></svg>- 5 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." />+ 10 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." /></li><li class="flex gap-x-3"><svg class="flex-none w-5 h-6 text-warning" viewBox="0 0 20 20" fill="currentColor"@@ -229,7 +229,7 @@{{ $ultimate }}@endisset@endif- <p class="h-20 mt-10 text-sm leading-6 text-white">Deploy complex infrastuctures and+ <p class="h-20 mt-10 text-sm leading-6 text-white">Deploy complex infrastructures andmanage them easily in one place.</p><ul role="list" class="mt-6 space-y-3 text-sm leading-6 "><li class="flex gap-x-3">@@ -239,7 +239,7 @@d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"clip-rule="evenodd" /></svg>- 15 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." />+ 25 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." /></li><li class="flex font-bold text-white gap-x-3"><svg class="flex-none w-5 h-6 text-warning" viewBox="0 0 20 20" fill="currentColor"diff --git a/resources/views/components/team/navbar.blade.php b/resources/views/components/team/navbar.blade.phpindex 91f7e863ed..39f5fff62f 100644--- a/resources/views/components/team/navbar.blade.php+++ b/resources/views/components/team/navbar.blade.php@@ -21,7 +21,7 @@</ol></nav><nav class="navbar-main">- <a class="{{ request()->routeIs('team.show') ? 'text-white' : '' }}" href="{{ route('team.show') }}">+ <a class="{{ request()->routeIs('team.index') ? 'text-white' : '' }}" href="{{ route('team.index') }}"><button>General</button></a><a class="{{ request()->routeIs('team.members') ? 'text-white' : '' }}" href="{{ route('team.members') }}">diff --git a/resources/views/livewire/subscription/actions.blade.php b/resources/views/livewire/subscription/actions.blade.phpindex 695ea2f788..e79ea90f70 100644--- a/resources/views/livewire/subscription/actions.blade.php+++ b/resources/views/livewire/subscription/actions.blade.php@@ -8,7 +8,7 @@@endif@if (currentTeam()->subscription->stripe_cancel_at_period_end)- <a class="hover:no-underline" href="{{ route('subscription.show') }}"><x-forms.button>Subscribe+ <a class="hover:no-underline" href="{{ route('subscription.index') }}"><x-forms.button>Subscribeagain</x-forms.button></a>@endif<x-forms.button wire:click='stripeCustomerPortal'>Manage My Subscription</x-forms.button>diff --git a/resources/views/profile.blade.php b/resources/views/profile.blade.phpindex c3c9bb60a3..a9498cd1e3 100644--- a/resources/views/profile.blade.php+++ b/resources/views/profile.blade.php@@ -3,7 +3,7 @@<div class="subtitle ">Your user profile settings.</div><livewire:profile.form :request="$request" /><h2 class="py-4">Subscription</h2>- <a href="{{ route('team.show') }}">Check in Team Settings</a>+ <a href="{{ route('team.index') }}">Check in Team Settings</a><h2 class="py-4">Two-factor Authentication</h2>@if (session('status') == 'two-factor-authentication-enabled')<div class="mb-4 font-medium">diff --git a/resources/views/subscription/show.blade.php b/resources/views/subscription/index.blade.phpsimilarity index 62%rename from resources/views/subscription/show.blade.phprename to resources/views/subscription/index.blade.phpindex 669e94c0e1..321551cad2 100644--- a/resources/views/subscription/show.blade.php+++ b/resources/views/subscription/index.blade.php@@ -3,7 +3,7 @@<div class="flex justify-center mx-10"><div x-data><div class="flex gap-2">- <h2>Subscription</h2>+ <h1>Subscription</h1><livewire:switch-team /></div><div class="flex items-center pb-8">@@ -11,7 +11,10 @@class="text-warning">{{ session('currentTeam.name') }}</span></span></div>@if(request()->query->get('cancelled'))- <div class="text-xl text-center text-red-500">Something went wrong. Please try again.</div>+ <div class="rounded alert alert-error">+ <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>+ <span>Something went wrong with your subscription. Please try again or contact support.</span>+ </div>@endif@if (config('subscription.provider') !== null)<livewire:subscription.pricing-plans />diff --git a/resources/views/team/show.blade.php b/resources/views/team/index.blade.phpsimilarity index 86%rename from resources/views/team/show.blade.phprename to resources/views/team/index.blade.phpindex 25a4654525..26b8f32f5a 100644--- a/resources/views/team/show.blade.php+++ b/resources/views/team/index.blade.php@@ -11,7 +11,7 @@<livewire:subscription.actions />@else<x-forms.button class="mt-4"><a class="text-white hover:no-underline"- href="{{ route('subscription.show') }}">Subscribe Now</a>+ href="{{ route('subscription.index') }}">Subscribe Now</a></x-forms.button>@endifdiff --git a/routes/web.php b/routes/web.phpindex b42ad6b5b1..73b4c6dce5 100644--- a/routes/web.php+++ b/routes/web.php@@ -98,13 +98,13 @@ Route::middleware(['auth'])->group(function () {Route::middleware(['throttle:force-password-reset'])->group(function () {Route::get('/force-password-reset', [Controller::class, 'force_passoword_reset'])->name('auth.force-password-reset');});- Route::get('/subscription', [Controller::class, 'subscription'])->name('subscription.show');+ Route::get('/subscription', [Controller::class, 'subscription'])->name('subscription.index');Route::get('/subscription/success', fn () => view('subscription.success'))->name('subscription.success');Route::get('/subscription/cancel', fn () => view('profile'))->name('subscription.cancel');Route::get('/settings', [Controller::class, 'settings'])->name('settings.configuration');Route::get('/settings/license', [Controller::class, 'license'])->name('settings.license');Route::get('/profile', fn () => view('profile', ['request' => request()]))->name('profile');- Route::get('/team', [Controller::class, 'team'])->name('team.show');+ Route::get('/team', [Controller::class, 'team'])->name('team.index');Route::get('/team/new', fn () => view('team.create'))->name('team.create');Route::get('/team/notifications', fn () => view('team.notifications'))->name('team.notifications');Route::get('/team/storages', [Controller::class, 'storages'])->name('team.storages.all');