Add additional condition

This commit is contained in:
Marcus Moore 2024-04-25 17:04:07 -07:00
parent 30bd920497
commit 2a71877bec
No known key found for this signature in database

View file

@ -4,6 +4,7 @@ namespace App\Http\Requests;
use App\Models\Asset;
use App\Models\Company;
use App\Models\Setting;
use Carbon\Carbon;
use Carbon\Exceptions\InvalidFormatException;
use Illuminate\Support\Facades\Gate;
@ -47,7 +48,7 @@ class StoreAssetRequest extends ImageUploadRequest
{
$modelRules = (new Asset)->getRules();
if (is_string($this->input('purchase_cost'))) {
if (Setting::getSettings()->digit_separator === '1.234,56' && is_string($this->input('purchase_cost'))) {
// If purchase_cost was submitted as a string with a comma separator
// then we need to ignore the normal numeric rules.
// Since the original rules still live on the model they will be run