我遇到1个问题。问题是订阅客户。当我在laravel中使用条纹收银员时。 https://appdividend.com/2018/12/05/laravel-stripe-payment-gateway-integration-tutorial-with-example/此链接给了我完美的答案。但现在我想删除订阅表中提供的收银员的某些列。我想删除桌子上的数量。
我的控制器:
//SubscriptionController.php
class SubscriptionController extends Controller
{
public function create(Request $request, Plan $plan)
{
$plan = Plan::findOrFail($request->get('plan'));
$stripeToken = $request->stripeToken;
$user = $request->user();
$stripeplan = $request->stripe_plan;
$planid = $request->plan;
$user->newSubscription($user->name, $planid)->create($stripeToken);
return redirect()->route('home')->with('success', 'Your plan subscribed successfully');
}
}
现在条纹收银员
//Billable
public function subscription($subscription = 'default')
{
return $this->subscriptions->sortByDesc(function ($value) {
return $value->created_at->getTimestamp();
})->first(function ($value) use ($subscription) {
return $value->name === $subscription;
});
}
// subscriptionBuilder.php
public function create($token = null, array $options = [])
{
$customer = $this->getStripeCustomer($token, $options);
$subscription = $customer->subscriptions->create($this->buildPayload());
if (in_array($subscription->status, ['incomplete', 'incomplete_expired'])) {
$subscription->cancel();
throw SubscriptionCreationFailed::incomplete($subscription);
}
if ($this->skipTrial) {
$trialEndsAt = null;
} else {
$trialEndsAt = $this->trialExpires;
}
return $this->owner->subscriptions()->create([
'name' => $this->name,
'stripe_id' => $subscription->id,
'stripe_plan' => $this->plan,
'quantity' => $this->quantity,
'trial_ends_at' => $trialEndsAt,
'ends_at' => null,
]);
}
我要删除这三个:
'quantity' => $this->quantity,
'trial_ends_at' => $trialEndsAt,
'ends_at' => null,
使用订阅控制器。如何覆盖