当前位置: 首页>>代码示例>>PHP>>正文


PHP Spark::interact方法代码示例

本文整理汇总了PHP中Laravel\Spark\Spark::interact方法的典型用法代码示例。如果您正苦于以下问题:PHP Spark::interact方法的具体用法?PHP Spark::interact怎么用?PHP Spark::interact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Laravel\Spark\Spark的用法示例。


在下文中一共展示了Spark::interact方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: baseValidator

 /**
  * Get the base validator instance for a register request.
  *
  * @return \Illuminate\Validation\Validator
  */
 public function baseValidator()
 {
     $validator = Spark::interact(CreateUser::class . '@validator', [$this]);
     $validator->sometimes('plan', 'required|in:' . Spark::activePlanIdList(), function () {
         return Spark::needsCardUpFront();
     });
     return $validator;
 }
开发者ID:defenestrator,项目名称:groid,代码行数:13,代码来源:RegisterRequest.php

示例2: subscribe

 /**
  * Subscribe the given user to a subscription plan.
  *
  * @param  RegisterRequest  $request
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return \Illuminate\Contracts\Auth\Authenticatable
  */
 protected function subscribe($request, $user)
 {
     if (!$request->hasPaidPlan()) {
         return $user;
     }
     Spark::interact(Subscribe::class, [$user, $request->plan(), true, $request->all()]);
     return $user;
 }
开发者ID:defenestrator,项目名称:groid,代码行数:15,代码来源:Register.php

示例3: interaction

 /**
  * Execute the given interaction.
  *
  * This performs the common validate and handle flow of some interactions.
  *
  * @param  Request  $request
  * @param  string  $interaction
  * @param  array  $parameters
  * @return void
  */
 public function interaction(Request $request, $interaction, array $parameters)
 {
     $validator = Spark::interact($interaction . '@validator', $parameters);
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     return Spark::interact($interaction, $parameters);
 }
开发者ID:defenestrator,项目名称:groid,代码行数:18,代码来源:Controller.php

示例4: show

 /**
  * Get the team matching the given ID.
  *
  * @param  Request  $request
  * @param  string  $teamId
  * @return Response
  */
 public function show(Request $request, $teamId)
 {
     $team = Spark::interact(TeamRepository::class . '@find', [$teamId]);
     abort_unless($request->user()->onTeam($team), 404);
     if ($request->user()->ownsTeam($team)) {
         $team->load('subscriptions');
         $team->shouldHaveOwnerVisibility();
     }
     return $team;
 }
开发者ID:defenestrator,项目名称:groid,代码行数:17,代码来源:TeamController.php

示例5: redeem

 /**
  * Redeem the given coupon code.
  *
  * @param  Request  $request
  * @return Response
  */
 public function redeem(Request $request)
 {
     $this->validate($request, ['coupon' => 'required']);
     // We will verify that the coupon can actually be redeemed. In some cases even
     // valid coupons can not get redeemed by an existing user if this coupon is
     // running as a promotion for brand new registrations to the application.
     if (!$this->coupons->canBeRedeemed($request->coupon)) {
         return response()->json(['coupon' => ['This coupon code is invalid.']], 422);
     }
     Spark::interact(RedeemCoupon::class, [$request->user(), $request->coupon]);
 }
开发者ID:defenestrator,项目名称:groid,代码行数:17,代码来源:RedeemCouponController.php

示例6: disable

 /**
  * Disable two-factor authentication for the user.
  *
  * @param  Request  $request
  * @return Response
  */
 public function disable(Request $request)
 {
     Spark::interact(DisableTwoFactorAuth::class, [$request->user()]);
     $request->user()->forceFill(['uses_two_factor_auth' => false])->save();
 }
开发者ID:defenestrator,项目名称:groid,代码行数:11,代码来源:TwoFactorAuthController.php

示例7: handle

 /**
  * {@inheritdoc}
  */
 public function handle($user, array $data)
 {
     event(new TeamCreated($team = Spark::interact(TeamRepository::class . '@create', [$user, $data])));
     Spark::interact(AddTeamMemberContract::class, [$team, $user, 'owner']);
     return $team;
 }
开发者ID:defenestrator,项目名称:groid,代码行数:9,代码来源:CreateTeam.php

示例8: store

 /**
  * Create the subscription for the team.
  *
  * @param  CreateSubscriptionRequest  $request
  * @param  Team  $team
  * @return Response
  */
 public function store(CreateSubscriptionRequest $request, Team $team)
 {
     Spark::interact(SubscribeTeam::class, [$team, $request->plan(), $request->all()]);
 }
开发者ID:defenestrator,项目名称:groid,代码行数:11,代码来源:PlanController.php

示例9: currentTeam

 /**
  * Get the current team for the user.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return \Laravel\Spark\Team|null
  */
 protected function currentTeam($user)
 {
     if (Spark::usesTeams() && $user->currentTeam()) {
         return Spark::interact(TeamRepository::class . '@find', [$user->currentTeam()->id]);
     }
 }
开发者ID:defenestrator,项目名称:groid,代码行数:12,代码来源:InitialFrontendState.php

示例10: accept

 /**
  * Accept the given invitations.
  *
  * @param  Request  $request
  * @param  \Laravel\Spark\Invitation  $invitation
  * @return Response
  */
 public function accept(Request $request, Invitation $invitation)
 {
     abort_unless($request->user()->id == $invitation->user_id, 404);
     Spark::interact(AddTeamMember::class, [$invitation->team, $request->user()]);
     $invitation->delete();
 }
开发者ID:defenestrator,项目名称:groid,代码行数:13,代码来源:PendingInvitationController.php

示例11: store

 /**
  * Create a new invitation.
  *
  * @param  CreateInvitationRequest  $request
  * @param  \Laravel\Spark\Team  $team
  * @return Response
  */
 public function store(CreateInvitationRequest $request, $team)
 {
     Spark::interact(SendInvitation::class, [$team, $request->email]);
 }
开发者ID:defenestrator,项目名称:groid,代码行数:11,代码来源:MailedInvitationController.php

示例12: handle

 /**
  * {@inheritdoc}
  */
 public function handle($request)
 {
     return Spark::interact(UserRepository::class . '@create', [$request->all()]);
 }
开发者ID:defenestrator,项目名称:groid,代码行数:7,代码来源:CreateUser.php

示例13: store

 /**
  * Create the subscription for the user.
  *
  * @param  CreateSubscriptionRequest  $request
  * @return Response
  */
 public function store(CreateSubscriptionRequest $request)
 {
     $plan = Spark::plans()->where('id', $request->plan)->first();
     Spark::interact(Subscribe::class, [$request->user(), $plan, false, $request->all()]);
 }
开发者ID:defenestrator,项目名称:groid,代码行数:11,代码来源:PlanController.php

示例14: disableTwoFactorAuth

 /**
  * Disable two-factor authentication for the given user.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return void
  */
 protected function disableTwoFactorAuth($user)
 {
     Spark::interact(DisableTwoFactorAuth::class, [$user]);
     $user->forceFill(['uses_two_factor_auth' => false])->save();
 }
开发者ID:defenestrator,项目名称:groid,代码行数:11,代码来源:EmergencyLoginController.php

示例15: update

 /**
  * Update the payment method for the user.
  *
  * @param  UpdatePaymentMethodRequest  $request
  * @return Response
  */
 public function update(UpdatePaymentMethodRequest $request)
 {
     Spark::interact(UpdatePaymentMethod::class, [$request->user(), $request->all()]);
 }
开发者ID:defenestrator,项目名称:groid,代码行数:10,代码来源:PaymentMethodController.php


注:本文中的Laravel\Spark\Spark::interact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。