php cs fixer tweak

This commit is contained in:
Peter Papp
2021-07-23 10:50:29 +02:00
parent d190eeb46d
commit 8951ebc69f
15 changed files with 70 additions and 105 deletions
@@ -48,14 +48,10 @@ class PaymentMethodsController extends Controller
// filter payment methods without default payment
$paymentMethodsMapped = Cache::rememberForever($slug_payment_methods, function () use ($defaultPaymentMethod, $user) {
$paymentMethods = $user->paymentMethods()->filter(function ($paymentMethod) use ($defaultPaymentMethod) {
return $paymentMethod->id !== $defaultPaymentMethod->id;
});
$paymentMethods = $user->paymentMethods()->filter(fn ($paymentMethod) => $paymentMethod->id !== $defaultPaymentMethod->id);
// Get payment methods
return $paymentMethods->map(function ($paymentMethod) {
return $paymentMethod->asStripePaymentMethod();
})->values()->all();
return $paymentMethods->map(fn ($paymentMethod) => $paymentMethod->asStripePaymentMethod())->values()->all();
});
}
@@ -13,9 +13,7 @@ class ActivePlansController
public function __invoke(): PricingCollection
{
// Get pricing from cache
$pricing = Cache::rememberForever('pricing', function () {
return resolve(StripeService::class)->getActivePlans();
});
$pricing = Cache::rememberForever('pricing', fn () => resolve(StripeService::class)->getActivePlans());
// Format pricing to collection
$collection = new PricingCollection($pricing);
@@ -22,9 +22,7 @@ class PlansController extends Controller
{
// Store or Get plans to cache
$plans = cache()
->rememberForever('plans', function () {
return $this->stripe->getPlans();
});
->rememberForever('plans', fn () => $this->stripe->getPlans());
return response(new PlanCollection($plans), 200);
}
@@ -36,9 +34,7 @@ class PlansController extends Controller
{
// Store or Get plan to cache
$plan = cache()
->rememberForever("plan-$id", function () use ($id) {
return $this->stripe->getPlan($id);
});
->rememberForever("plan-$id", fn () => $this->stripe->getPlan($id));
return response(new PlanResource($plan), 200);
}
@@ -51,9 +47,7 @@ class PlansController extends Controller
{
if (is_demo()) {
$plan = cache()
->rememberForever('plan-starter-pack', function () {
return $this->stripe->getPlan('starter-pack');
});
->rememberForever('plan-starter-pack', fn () => $this->stripe->getPlan('starter-pack'));
return new PlanResource($plan);
}
@@ -21,9 +21,7 @@ class StripeWebhookController extends CashierController
public function handleCustomerSubscriptionDeleted($payload)
{
if ($user = $this->getUserByStripeId($payload['data']['object']['customer'])) {
$user->subscriptions->filter(function ($subscription) use ($payload) {
return $subscription->stripe_id === $payload['data']['object']['id'];
})->each(function ($subscription) {
$user->subscriptions->filter(fn ($subscription) => $subscription->stripe_id === $payload['data']['object']['id'])->each(function ($subscription) {
$subscription->markAsCancelled();
});
}
@@ -17,9 +17,7 @@ trait Subscription
);
// Find tax rate
$user_tax_rate = $rates->first(function ($item) {
return $item['country'] === $this->settings->country && $item['active'];
});
$user_tax_rate = $rates->first(fn ($item) => $item['country'] === $this->settings->country && $item['active']);
return $user_tax_rate ? [$user_tax_rate['id']] : [];
}