本文整理汇总了PHP中Laravel\Spark\Spark::teamPlans方法的典型用法代码示例。如果您正苦于以下问题:PHP Spark::teamPlans方法的具体用法?PHP Spark::teamPlans怎么用?PHP Spark::teamPlans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Laravel\Spark\Spark
的用法示例。
在下文中一共展示了Spark::teamPlans方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validatePlanEligibility
/**
* Validate that the plan is eligible based on team restrictions.
*
* @param \Illuminate\Validation\Validator $valdiator
* @return void
*/
protected function validatePlanEligibility($validator)
{
$plan = Spark::teamPlans()->where('id', $this->plan)->first();
// If the desired plan is free, we will always need to let the user switch to that
// plan since we'll want the user to always be able to cancel this subscription
// without preventing them. So, we will just return here if it's a free plan.
if (!$plan || $plan->price === 0) {
return;
}
$this->callCustomCallback($validator, $plan);
// If the user is ineligible for a plan based on their team member or collaborator
// count, we will prevent them switching to this plan and send an error message
// back to the client informing them of this limitation and they can upgrade.
if (!$this->teamIsEligibleForPlan($this->route('team'), $plan)) {
$validator->errors()->add('plan', 'This team has too many team members for the selected plan.');
}
}
示例2: availablePlans
/**
* Get the available billing plans for the given entity.
*
* @return \Illuminate\Support\Collection
*/
public function availablePlans()
{
return Spark::teamPlans();
}
示例3: all
/**
* Get the all of the team plans defined for the appliation.
*
* @return Response
*/
public function all()
{
return response()->json(Spark::teamPlans());
}
示例4: plan
/**
* Get the Spark plan associated with the request.
*
* @return \Laravel\Spark\Plan
*/
public function plan()
{
return Spark::teamPlans()->where('id', $this->plan)->first();
}