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.

Use match when possible.

Lucas Michote2b396a0f0a9
diff --git a/app/Livewire/Project/Shared/Danger.php b/app/Livewire/Project/Shared/Danger.php
index 2a21532ce6..a0b4ac2c45 100644
--- a/app/Livewire/Project/Shared/Danger.php
+++ b/app/Livewire/Project/Shared/Danger.php
@@ -62,32 +62,21 @@ class Danger extends Component
return;
}
- switch ($this->resource->type()) {
- case 'application':
- $this->resourceName = $this->resource->name ?? 'Application';
- break;
- case 'standalone-postgresql':
- case 'standalone-redis':
- case 'standalone-mongodb':
- case 'standalone-mysql':
- case 'standalone-mariadb':
- case 'standalone-keydb':
- case 'standalone-dragonfly':
- case 'standalone-clickhouse':
- $this->resourceName = $this->resource->name ?? 'Database';
- break;
- case 'service':
- $this->resourceName = $this->resource->name ?? 'Service';
- break;
- case 'service-application':
- $this->resourceName = $this->resource->name ?? 'Service Application';
- break;
- case 'service-database':
- $this->resourceName = $this->resource->name ?? 'Service Database';
- break;
- default:
- $this->resourceName = 'Unknown Resource';
- }
+ $this->resourceName = match ($this->resource->type()) {
+ 'application' => $this->resource->name ?? 'Application',
+ 'standalone-postgresql',
+ 'standalone-redis',
+ 'standalone-mongodb',
+ 'standalone-mysql',
+ 'standalone-mariadb',
+ 'standalone-keydb',
+ 'standalone-dragonfly',
+ 'standalone-clickhouse' => $this->resource->name ?? 'Database',
+ 'service' => $this->resource->name ?? 'Service',
+ 'service-application' => $this->resource->name ?? 'Service Application',
+ 'service-database' => $this->resource->name ?? 'Service Database',
+ default => 'Unknown Resource',
+ };
}
public function delete($password)
diff --git a/app/Livewire/Subscription/PricingPlans.php b/app/Livewire/Subscription/PricingPlans.php
index 9bc11d862d..09d11038d6 100644
--- a/app/Livewire/Subscription/PricingPlans.php
+++ b/app/Livewire/Subscription/PricingPlans.php
@@ -22,35 +22,19 @@ class PricingPlans extends Component
{
$team = currentTeam();
Stripe::setApiKey(config('subscription.stripe_api_key'));
- switch ($type) {
- case 'basic-monthly':
- $priceId = config('subscription.stripe_price_id_basic_monthly');
- break;
- case 'basic-yearly':
- $priceId = config('subscription.stripe_price_id_basic_yearly');
- break;
- case 'pro-monthly':
- $priceId = config('subscription.stripe_price_id_pro_monthly');
- break;
- case 'pro-yearly':
- $priceId = config('subscription.stripe_price_id_pro_yearly');
- break;
- case 'ultimate-monthly':
- $priceId = config('subscription.stripe_price_id_ultimate_monthly');
- break;
- case 'ultimate-yearly':
- $priceId = config('subscription.stripe_price_id_ultimate_yearly');
- break;
- case 'dynamic-monthly':
- $priceId = config('subscription.stripe_price_id_dynamic_monthly');
- break;
- case 'dynamic-yearly':
- $priceId = config('subscription.stripe_price_id_dynamic_yearly');
- break;
- default:
- $priceId = config('subscription.stripe_price_id_basic_monthly');
- break;
- }
+
+ $priceId = match ($type) {
+ 'basic-monthly' => config('subscription.stripe_price_id_basic_monthly'),
+ 'basic-yearly' => config('subscription.stripe_price_id_basic_yearly'),
+ 'pro-monthly' => config('subscription.stripe_price_id_pro_monthly'),
+ 'pro-yearly' => config('subscription.stripe_price_id_pro_yearly'),
+ 'ultimate-monthly' => config('subscription.stripe_price_id_ultimate_monthly'),
+ 'ultimate-yearly' => config('subscription.stripe_price_id_ultimate_yearly'),
+ 'dynamic-monthly' => config('subscription.stripe_price_id_dynamic_monthly'),
+ 'dynamic-yearly' => config('subscription.stripe_price_id_dynamic_yearly'),
+ default => config('subscription.stripe_price_id_basic_monthly'),
+ };
+
if (! $priceId) {
$this->dispatch('error', 'Price ID not found! Please contact the administrator.');