66 lines
1.4 KiB
PHP
66 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
|
|
/**
|
|
* This is the model class for table "currency".
|
|
*
|
|
* @property integer $id_currency
|
|
* @property string $currency
|
|
* @property string $name
|
|
* @property integer $rate
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
*/
|
|
class Currency extends \common\models\BaseFitnessActiveRecord
|
|
{
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'currency';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['currency', 'name'], 'required'],
|
|
[['rate'], 'integer'],
|
|
[['currency'], 'string', 'max' => 10],
|
|
[['name'], 'string', 'max' => 32]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id_currency' => Yii::t('common/currency', 'Id Currency'),
|
|
'currency' => Yii::t('common/currency', 'Currency'),
|
|
'name' => Yii::t('common/currency', 'Name'),
|
|
'rate' => Yii::t('common/currency', 'Rate'),
|
|
'created_at' => Yii::t('common/currency', 'Created At'),
|
|
'updated_at' => Yii::t('common/currency', 'Updated At'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param integer $money
|
|
* @param common\models\Currency $currency
|
|
* */
|
|
public static function applyCurrency( $money,$currency ) {
|
|
$result = $money / $currency;
|
|
return $result;
|
|
}
|
|
|
|
|
|
}
|