PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / DonationForms / SubscriptionQuery.php

SubscriptionQuery.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/DonationForms/SubscriptionQuery.php

68 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\DonationForms;
4
5 use Give\Framework\QueryBuilder\QueryBuilder;
6
7 /**
8 * @since 3.12.0
9 */
10 class SubscriptionQuery extends QueryBuilder
11 {
12 /**
13 * @since 3.12.0
14 */
15 public function __construct()
16 {
17 $this->from('give_subscriptions');
18 }
19
20 /**
21 * @since 3.12.0
22 */
23 public function form($formId)
24 {
25 $this->where('product_id', $formId);
26 return $this;
27 }
28
29
30 /**
31 * @since 3.12.0
32 */
33 public function forms(array $formIds)
34 {
35 $this->whereIn('product_id', $formIds);
36 return $this;
37 }
38
39 /**
40 * @since 3.12.0
41 */
42 public function between($startDate, $endDate)
43 {
44 $this->whereBetween(
45 'created',
46 date('Y-m-d H:i:s', strtotime($startDate)),
47 date('Y-m-d H:i:s', strtotime($endDate))
48 );
49 return $this;
50 }
51
52 /**
53 * @since 3.12.0
54 */
55 public function sumInitialAmount()
56 {
57 return $this->sum('initial_amount');
58 }
59
60 /**
61 * @since 3.12.0
62 */
63 public function countDonors()
64 {
65 return $this->count('DISTINCT customer_id');
66 }
67 }
68