Lint PHP code psr-12, add GH action

This commit is contained in:
Julien Nahum
2024-02-23 11:54:12 +01:00
parent e85e4df7fe
commit 62971a2ef4
226 changed files with 2338 additions and 2144 deletions

View File

@@ -9,10 +9,11 @@ use Laravel\Cashier\Subscription;
class SubscriptionController extends Controller
{
const SUBSCRIPTION_PLANS = ['monthly', 'yearly'];
public const SUBSCRIPTION_PLANS = ['monthly', 'yearly'];
const PRO_SUBSCRIPTION_NAME = 'default';
const SUBSCRIPTION_NAMES = [
public const PRO_SUBSCRIPTION_NAME = 'default';
public const SUBSCRIPTION_NAMES = [
self::PRO_SUBSCRIPTION_NAME,
];
@@ -30,7 +31,7 @@ class SubscriptionController extends Controller
if ($user->subscriptions()->where('stripe_status', 'past_due')->first()) {
return $this->error([
'message' => 'You already have a past due subscription. Please verify your details in the billing page,
and contact us if the issue persists.'
and contact us if the issue persists.',
]);
}
@@ -51,18 +52,18 @@ class SubscriptionController extends Controller
'customer_update' => [
'address' => 'auto',
'name' => 'never',
]
],
]);
return $this->success([
'checkout_url' => $checkout->url
'checkout_url' => $checkout->url,
]);
}
public function updateStripeDetails(UpdateStripeDetailsRequest $request)
{
$user = Auth::user();
if (!$user->hasStripeId()) {
if (! $user->hasStripeId()) {
$user->createAsStripeCustomer();
}
$user->updateStripeCustomer([
@@ -78,13 +79,14 @@ class SubscriptionController extends Controller
public function billingPortal()
{
$this->middleware('auth');
if (!Auth::user()->has_customer_id) {
if (! Auth::user()->has_customer_id) {
return $this->error([
"message" => "Please subscribe before accessing your billing portal."
'message' => 'Please subscribe before accessing your billing portal.',
]);
}
return $this->success([
'portal_url' => Auth::user()->billingPortalUrl(front_url('/home'))
'portal_url' => Auth::user()->billingPortalUrl(front_url('/home')),
]);
}