Skip to content

Instantly share code, notes, and snippets.

@uluumbch
Last active June 6, 2022 11:58
Show Gist options
  • Save uluumbch/284e336f498015163aa97b357cf7c133 to your computer and use it in GitHub Desktop.
Save uluumbch/284e336f498015163aa97b357cf7c133 to your computer and use it in GitHub Desktop.
How to create number formatting(currency) in Laravel livewire powergrid

To add formating, just simply add closure to ->addColumn function

...
public function addColumns(): PowerGridEloquent{
->addColumn('column_name', function (Model $model){
                return "Rp".number_format($model->currency_table_name,0,',','.');
            })
            ...

here is my example code

->addColumn('total_harga', function (Penjualan $penjualan){
                return "Rp".number_format($penjualan->total_harga,0,',','.');
            })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment