/**
  * Get the recurring revenue for the given interval.
  *
  * @param  string  $interval
  * @return float
  */
 protected function recurringRevenueByInterval($interval)
 {
     $total = 0;
     $plans = $interval == 'monthly' ? Spark::allMonthlyPlans() : Spark::allYearlyPlans();
     foreach ($plans as $plan) {
         $total += DB::table($plan instanceof TeamPlan ? 'team_subscriptions' : 'subscriptions')->where($this->planColumn(), $plan->id)->where(function ($query) {
             $query->whereNull('trial_ends_at')->orWhere('trial_ends_at', '<=', Carbon::now());
         })->whereNull('ends_at')->sum('quantity') * $plan->price;
     }
     return $total;
 }