currently i'm facing some issue in laravel input validation where the validation rules for between seems like doesnt apply correctly. Below is my HTML code.
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="margin-bottom-10">
<label>Thread Title :</label>
<input name="thread_title" maxlength="100" required>
</div>
<div class="margin-bottom-10">
<label>Price :</label>
<input type="number" step="0.01" min="0" required title="Please enter price with x.xx format." name="thread_item_price" />
</div>
What i'm trying to do is to validate the given price must be between 0 and 9999.99. I inspect element and remove the min="0" and try to submit with negative value says -1000, the system seems to accept the input. Below is my validator rules
$validator = Validator::make($request::all(),
[
'thread_title' => 'required|max:100',
'thread_item_price' => 'between:0,9999.99'
],
[
'thread_title.required' => 'Please fill in thread title.',
'thread_title.max' => 'Thread title has exceeded 100 characters.',
'thread_item_price.required' => 'Price cannot be empty.',
'thread_item_price.between' => 'Price must be equals to 0 or 9999.99.',
]);
if ($validator->fails()) {
return Redirect::back()
->withErrors($validator)
->withInput();
};
Am i doing something wrong and make the validation failed?