44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
namespace ProVM\Crypto;
|
|
|
|
use ProVM\Common\Alias\Model;
|
|
use ProVM\Common\Define\Model\DateTime as DT;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property \DateTime $date_time
|
|
* @property Coin $coin_id
|
|
* @property Wallet $wallet_id
|
|
* @property float $amount
|
|
* @property float $value
|
|
* @property Coin $unit_id
|
|
*/
|
|
class Transaction extends Model {
|
|
use DT;
|
|
|
|
protected static $_table = 'transactions';
|
|
protected static $fields = ['date_time', 'coin_id', 'wallet_id', 'amount', 'value', 'unit_id'];
|
|
|
|
protected $coin;
|
|
public function coin() {
|
|
if ($this->coin === null) {
|
|
$this->coin = $this->childOf(Coin::class, [Model::SELF_KEY => 'coin_id']);
|
|
}
|
|
return $this->coin;
|
|
}
|
|
protected $wallet;
|
|
public function wallet() {
|
|
if ($this->wallet === null) {
|
|
$this->wallet = $this->childOf(Wallet::class, [Model::SELF_KEY => 'wallet_id']);
|
|
}
|
|
return $this->wallet;
|
|
}
|
|
protected $unit;
|
|
public function unit() {
|
|
if ($this->unit === null) {
|
|
$this->unit = $this->childOf(Coin::class, [Model::SELF_KEY => 'unit_id']);
|
|
}
|
|
return $this->unit;
|
|
}
|
|
}
|