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');
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 void10 */11 public function setted(string $name, string $currency, float $amount)12 {13 //14 }15 16 /**17 * Withdrew Money Event18 *19 * @param string $name20 * @param string $currency21 * @param float $amount22 * @return void23 */24 public function withdrew(string $name, string $currency, float $amount)25 {26 //27 }28 29 /**30 * Deposited Money Event31 *32 * @param string $name33 * @param string $currency34 * @param float $amount35 * @return void36 */37 public function deposited(string $name, string $currency, float $amount)38 {39 //40 }41 42 /**43 * Reset Money Event44 *45 * @param string $name46 * @param string $currency47 * @return void48 */49 public function reset(string $name, string $currency)50 {51 //52 }53}