當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Spark::call方法代碼示例

本文整理匯總了PHP中Laravel\Spark\Spark::call方法的典型用法代碼示例。如果您正苦於以下問題:PHP Spark::call方法的具體用法?PHP Spark::call怎麽用?PHP Spark::call使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Laravel\Spark\Spark的用法示例。


在下文中一共展示了Spark::call方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * {@inheritdoc}
  */
 public function handle($team, $plan, array $data)
 {
     $subscription = $team->newSubscription('default', $plan->id);
     // Here we will fill the trial days for this team subscription. We will also set any
     // coupon on the subscription so that the team can receive a discount on the team
     // subscription. Then we will almost be ready to create the final subscription.
     $subscription->trialDays($plan->trialDays);
     if (isset($data['coupon'])) {
         $subscription->withCoupon($data['coupon']);
     }
     // Next, we need to check if this application is storing billing addresses and if so
     // we will update the billing address in the database so that any tax information
     // on the team will be up to date via the taxPercentage method on the billable.
     if (Spark::collectsBillingAddress()) {
         Spark::call(TeamRepository::class . '@updateBillingAddress', [$team, $data]);
     }
     // If this application collects European VAT, we will store the VAT ID that was sent
     // with the request. It is used to determine if the VAT should get charged at all
     // when billing the customer. When it is present, VAT is not typically charged.
     if (Spark::collectsEuropeanVat()) {
         Spark::call(TeamRepository::class . '@updateVatId', [$team, array_get($data, 'vat_id')]);
     }
     // Here we will create the actual subscription on the service and fire off the event
     // letting other listeners know a team has subscribed, which will allow any hooks
     // to fire that need to send the subscription data to any external metrics app.
     $subscription->create($data[$this->token]);
     event(new TeamSubscribed($team = $team->fresh(), $plan));
     return $team;
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:32,代碼來源:SubscribeTeam.php

示例2: handle

 /**
  * {@inheritdoc}
  */
 public function handle($user, $plan, $fromRegistration, array $data)
 {
     $subscription = $user->newSubscription('default', $plan->id);
     // Here we will check if we need to skip trial or set trial days on the subscription
     // when creating it on the provider. By default, we will skip the trial when this
     // interaction is not from egistration since they have already usually trialed.
     if (!$fromRegistration) {
         $subscription->skipTrial();
     } elseif ($plan->trialDays > 0) {
         $subscription->trialDays($plan->trialDays);
     }
     if (isset($data['coupon'])) {
         $subscription->withCoupon($data['coupon']);
     }
     // Next, we need to check if this application is storing billing addresses and if so
     // we will update the billing address in the database so that any tax information
     // on the user will be up to date via the taxPercentage method on the billable.
     if (Spark::collectsBillingAddress()) {
         Spark::call(UserRepository::class . '@updateBillingAddress', [$user, $data]);
     }
     // If this application collects European VAT, we will store the VAT ID that was sent
     // with the request. It is used to determine if the VAT should get charged at all
     // when billing the customer. When it is present, VAT is not typically charged.
     if (Spark::collectsEuropeanVat()) {
         Spark::call(UserRepository::class . '@updateVatId', [$user, array_get($data, 'vat_id')]);
     }
     // Here we will create the actual subscription on the service and fire off the event
     // letting other listeners know a user has subscribed, which will allow any hooks
     // to fire that need to send the subscription data to any external metrics app.
     $subscription->create($data[$this->token]);
     event(new UserSubscribed($user = $user->fresh(), $plan, $fromRegistration));
     return $user;
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:36,代碼來源:Subscribe.php

示例3: handle

 /**
  * {@inheritdoc}
  */
 public function handle($billable, array $data)
 {
     // Next, we need to check if this application is storing billing addresses and if so
     // we will update the billing address in the database so that any tax information
     // on the user will be up to date via the taxPercentage method on the billable.
     if (Spark::collectsBillingAddress()) {
         Spark::call($this->updateBillingAddressMethod($billable), [$billable, $data]);
     }
     // If a billable entity already has a Stripe ID, we will just update their card then
     // return, but if entities do not have a Stripe ID, we'll need to create a Stripe
     // customer with this given token so that they really exist in Stripe's system.
     if ($billable->stripe_id) {
         $billable->updateCard($data['stripe_token']);
     } else {
         $billable->createAsStripeCustomer($data['stripe_token']);
     }
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:20,代碼來源:UpdateStripePaymentMethod.php

示例4: baseValidator

 /**
  * Create a base validator instance for creating a user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Validation\Validator
  */
 protected function baseValidator($request)
 {
     return Validator::make($request->all(), Spark::call(static::class . '@rules', [$request]), [], ['address_line_2' => 'second address line']);
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:10,代碼來源:CreateUser.php

示例5: scriptVariables

 /**
  * Get the default JavaScript variables for Spark.
  *
  * @return array
  */
 public static function scriptVariables()
 {
     return ['braintreeMerchantId' => config('services.braintree.merchant_id'), 'braintreeToken' => Spark::billsUsingBraintree() ? BraintreeClientToken::generate() : null, 'cardUpFront' => Spark::needsCardUpFront(), 'collectsBillingAddress' => Spark::collectsBillingAddress(), 'collectsEuropeanVat' => Spark::collectsEuropeanVat(), 'csrfToken' => csrf_token(), 'currencySymbol' => Cashier::usesCurrencySymbol(), 'env' => config('app.env'), 'roles' => Spark::roles(), 'state' => Spark::call(InitialFrontendState::class . '@forUser', [Auth::user()]), 'stripeKey' => config('services.stripe.key'), 'userId' => Auth::id(), 'usesApi' => Spark::usesApi(), 'usesBraintree' => Spark::billsUsingBraintree(), 'usesTeams' => Spark::usesTeams(), 'usesStripe' => Spark::billsUsingStripe()];
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:9,代碼來源:ProvidesScriptVariables.php

示例6: update

 /**
  * Update the VAT ID for the team.
  *
  * @param  Request  $request
  * @param  Team  $team
  * @return Response
  */
 public function update(Request $request, Team $team)
 {
     $this->validate($request, ['vat_id' => 'max:50|vat_id']);
     Spark::call(TeamRepository::class . '@updateVatId', [$team, $request->vat_id]);
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:12,代碼來源:VatIdController.php

示例7: show

 /**
  * Get the user to be displayed on the user profile screen.
  *
  * @param  Request  $request
  * @param  string  $id
  * @return Response
  */
 public function show(Request $request, $id)
 {
     $user = Spark::call(UserRepository::class . '@find', [$id]);
     return response()->json(['user' => $user, 'revenue' => $this->indicators->totalRevenueForUser($user)]);
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:12,代碼來源:ProfileController.php

示例8: update

 /**
  * Update the VAT ID for the user.
  *
  * @param  Request  $request
  * @return Response
  */
 public function update(Request $request)
 {
     $this->validate($request, ['vat_id' => 'max:50|vat_id']);
     Spark::call(UserRepository::class . '@updateVatId', [$request->user(), $request->vat_id]);
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:11,代碼來源:VatIdController.php


注:本文中的Laravel\Spark\Spark::call方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。