Skip to content

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.

feat: delete team in cloud without subscription

Andras Bacsai1d8c49690640
diff --git a/app/Livewire/NavbarDeleteTeam.php b/app/Livewire/NavbarDeleteTeam.php
new file mode 100644
index 0000000000..ec196c1543
--- /dev/null
+++ b/app/Livewire/NavbarDeleteTeam.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Livewire;
+
+use Illuminate\Support\Facades\DB;
+use Livewire\Component;
+
+class NavbarDeleteTeam extends Component
+{
+ public function delete()
+ {
+ $currentTeam = currentTeam();
+ $currentTeam->delete();
+
+ $currentTeam->members->each(function ($user) use ($currentTeam) {
+ if ($user->id === auth()->user()->id) {
+ return;
+ }
+ $user->teams()->detach($currentTeam);
+ $session = DB::table('sessions')->where('user_id', $user->id)->first();
+ if ($session) {
+ DB::table('sessions')->where('id', $session->id)->delete();
+ }
+ });
+
+ refreshSession();
+
+ return redirect()->route('team.index');
+ }
+
+ public function render()
+ {
+ return view('livewire.navbar-delete-team');
+ }
+}
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index fbb5291fbc..7da6193777 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -351,6 +351,9 @@
</a>
</li>
@endif
+ @if (!isSubscribed() && isCloud() && auth()->user()->teams()->get()->count() > 1)
+ <livewire:navbar-delete-team />
+ @endif
<li>
<x-modal-input title="How can we help?">
<x-slot:content>
@@ -380,44 +383,5 @@
</li>
</ul>
</li>
- {{-- <li>
- <div class="text-xs font-semibold leading-6 text-gray-400">Your teams</div>
- <ul role="list" class="mt-2 -mx-2 space-y-1">
- <li>
- <a href="#"
- class="flex p-2 text-sm font-semibold leading-6 text-gray-700 rounded-md hover:text-indigo-600 hover:bg-gray-50 group gap-x-3">
- <span
- class="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border text-[0.625rem] font-medium bg-white text-gray-400 border-gray-200 group-hover:border-indigo-600 group-hover:text-indigo-600">H</span>
- <span class="truncate">Heroicons</span>
- </a>
- </li>
- <li>
- <a href="#"
- class="flex p-2 text-sm font-semibold leading-6 text-gray-700 rounded-md hover:text-indigo-600 hover:bg-gray-50 group gap-x-3">
- <span
- class="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border text-[0.625rem] font-medium bg-white text-gray-400 border-gray-200 group-hover:border-indigo-600 group-hover:text-indigo-600">T</span>
- <span class="truncate">Tailwind Labs</span>
- </a>
- </li>
- <li>
- <a href="#"
- class="flex p-2 text-sm font-semibold leading-6 text-gray-700 rounded-md hover:text-indigo-600 hover:bg-gray-50 group gap-x-3">
- <span
- class="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border text-[0.625rem] font-medium bg-white text-gray-400 border-gray-200 group-hover:border-indigo-600 group-hover:text-indigo-600">W</span>
- <span class="truncate">Workcation</span>
- </a>
- </li>
- </ul>
- </li>
- <li class="mt-auto -mx-6">
- <a href="#"
- class="flex items-center px-6 py-3 text-sm font-semibold leading-6 text-gray-900 gap-x-4 hover:bg-gray-50">
- <img class="w-8 h-8 rounded-full bg-gray-50"
- src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
- alt="">
- <span class="sr-only">Your profile</span>
- <span aria-hidden="true">Tom Cook</span>
- </a>
- </li> --}}
</ul>
</nav>
diff --git a/resources/views/livewire/navbar-delete-team.blade.php b/resources/views/livewire/navbar-delete-team.blade.php
new file mode 100644
index 0000000000..b660a0dd4d
--- /dev/null
+++ b/resources/views/livewire/navbar-delete-team.blade.php
@@ -0,0 +1,5 @@
+<div>
+ <x-modal-confirmation buttonFullWidth isErrorButton buttonTitle="Delete Team">
+ This team be deleted. It is not reversible. <br>Please think again.
+ </x-modal-confirmation>
+</div>