How to add Money Format in Backpackforlaravel #344
christmex
started this conversation in
Tips & Tricks
Replies: 2 comments 1 reply
-
Thanks for posting about this @christmex ! I'm sure someone will need this and find it helpful! |
Beta Was this translation helpful? Give feedback.
0 replies
-
We are currently also using backpack PRO and are are tinkering with a Money type field integrating https://github.com/brick/money as a laravel AttributeCasts https://andy.cowan.me.uk/handling-money-types-in-laravel) But i think this should be a really goed standard field type; could this be promoted to an idea? @tabacitu , cc @Tuoww |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
*note :
Hi there, in this tutorial I'm about to share with you guys how to add a new custom money format field in backpackforlaravel, without any further ado let's begin.
Steps
Step 1. Install Laravel Vite
first, we need to install [laravel vite], make sure you already have node js and npm, for checking if is it already there you can use this command
I assume you already have it, if you're not then please install it first, you can find the tutorial on the internet, alright, next open your terminal inside your backpackforlaravel project and use this command. (I highlight recommend you open the vite documentation if you’re new)
after the installation is finished, open and edit your vite.config.js file, so it will look like this,
Step 2. Create money_format.js
the next step is to create a js file that can help you to format the number become money format, in this case, I'm using the Rupiah money format from Indonesia,
after you create the money_format.js file, open and edit your app.js file inside “resources/js/app.js”
Step 4. Final step
Now you need to register your app.js inside “config/backpack/base.php”, find this line
and add 'resources/js/app.js', inside "vite_scripts" array
last, compile your assets with laravel vite, again open your terminal and paste this command,
wait for the process to finish and now you are ready to go.
Next
Beta Was this translation helpful? Give feedback.
All reactions