Merge pull request #4085 from lucasmichot/feat/match
Use match when possible.
This commit is contained in:
@@ -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)
|
||||
|
@@ -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.');
|
||||
|
||||
|
Reference in New Issue
Block a user