yii\db\SchemaBuilderTrait::money PHP Method

money() public method

Creates a money column.
Since: 2.0.6
public money ( integer $precision = null, integer $scale = null ) : ColumnSchemaBuilder
$precision integer column value precision, which is usually the total number of digits. First parameter passed to the column type, e.g. DECIMAL(precision, scale). This parameter will be ignored if not supported by the DBMS.
$scale integer column value scale, which is usually the number of digits after the decimal point. Second parameter passed to the column type, e.g. DECIMAL(precision, scale). This parameter will be ignored if not supported by the DBMS.
return ColumnSchemaBuilder the column instance which can be further customized.
    public function money($precision = null, $scale = null)
    {
        $length = [];
        if ($precision !== null) {
            $length[] = $precision;
        }
        if ($scale !== null) {
            $length[] = $scale;
        }
        return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_MONEY, $length);
    }