Pharaonic
Loading...

Aggregates / Events

Aggregates / Events

# Aggregates

1// Getting MIN Money
2echo Person::minMoney('balance');
3echo Person::minMoney('balance', 'USD');
4 
5// Getting MAX Money
6echo Person::maxMoney('balance');
7echo Person::maxMoney('balance', 'USD');
8 
9// Getting SUM All Monies
10echo Person::sumMoney('balance');
11echo Person::sumMoney('balance', 'USD');
12 
13// Getting SUM Negative Monies
14echo Person::sumNegativeMoney('balance');
15echo Person::sumNegativeMoney('balance', 'USD');
16 
17// Getting SUM Positive Monies
18echo Person::sumPositiveMoney('balance');
19echo Person::sumPositiveMoney('balance', 'USD');
20 
21// Getting Average Monies
22echo Person::avgMoney('balance');
23echo Person::avgMoney('balance', 'USD');
24 
25// Getting Count OF Monies Rows
26echo Person::countMoney();
27echo Person::countMoney('balance');
28echo Person::countMoney(null, 'USD');
29echo Person::countMoney('balance', 'USD');

# Events

You can use events like : setted, withdrew, deposited, reset to run jobs or send notifications or store them as logs

1class Person extends Model
2{
3 /**
4 * Setted Money with (Create/New/money method) Event
5 *
6 * @param string $name
7 * @param string $currency
8 * @param float $amount
9 * @return void
10 */
11 public function setted(string $name, string $currency, float $amount)
12 {
13 //
14 }
15 
16 /**
17 * Withdrew Money Event
18 *
19 * @param string $name
20 * @param string $currency
21 * @param float $amount
22 * @return void
23 */
24 public function withdrew(string $name, string $currency, float $amount)
25 {
26 //
27 }
28 
29 /**
30 * Deposited Money Event
31 *
32 * @param string $name
33 * @param string $currency
34 * @param float $amount
35 * @return void
36 */
37 public function deposited(string $name, string $currency, float $amount)
38 {
39 //
40 }
41 
42 /**
43 * Reset Money Event
44 *
45 * @param string $name
46 * @param string $currency
47 * @return void
48 */
49 public function reset(string $name, string $currency)
50 {
51 //
52 }
53}