Update validation for creation of earnings/spendings to only accept 2 decimal places for amount field for none decimal places at all
MODIFY
app/Http/Controllers/EarningsController.php
app/Http/Controllers/EarningsController.php
@@ -29,7 +29,7 @@ class EarningsController extends Controller {
$request->validate([
'date' => 'required|date|date_format:Y-m-d',
'description' => 'required|max:255',
- 'amount' => 'required|regex:/^\d*(\.\d{1,2})?$/'
+ 'amount' => 'required|regex:/^\d*(\.\d{2})?$/'
]);
$earning = new Earning;

MODIFY
app/Http/Controllers/SpendingsController.php
app/Http/Controllers/SpendingsController.php
@@ -33,7 +33,7 @@ class SpendingsController extends Controller {
'tag_id' => 'nullable|exists:tags,id', // TODO CHECK IF TAG BELONGS TO USER
'date' => 'required|date|date_format:Y-m-d',
'description' => 'required|max:255',
- 'amount' => 'required|regex:/^\d*(\.\d{1,2})?$/'
+ 'amount' => 'required|regex:/^\d*(\.\d{2})?$/'
]);
$spending = new Spending;

Update validation for creation of earnings/spendings to only accept 2 decimal places for amount field for none decimal places at all