Skip to content

Commit

Permalink
Merge pull request #5497 from taha-moghaddam/patch-1
Browse files Browse the repository at this point in the history
Show field as number
  • Loading branch information
jxlwqq authored Jan 3, 2022
2 parents 45c58c6 + 2e07ec9 commit e0e1748
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Show/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,21 @@ public function badge($style = 'blue')
});
}

/**
* Show field as number
*
* @param int $decimals
* @param string $decimal_seperator
* @param string $thousands_seperator
* @return Field
*/
public function number($decimals = 0, $decimal_seperator = '.', $thousands_seperator = ',')
{
return $this->unescape()->as(function ($value) use ($decimals, $decimal_seperator, $thousands_seperator) {
return number_format($value, $decimals, $decimal_seperator, $thousands_seperator);
});
}

/**
* Show field as json code.
*
Expand Down

0 comments on commit e0e1748

Please sign in to comment.