S
S
SvizzZzy2018-06-20 07:30:53
Laravel
SvizzZzy, 2018-06-20 07:30:53

How to leave only numbers and two characters in laravel validate: - / (dash and slash)?

Hello.
For example, I have a field for validate:
'number' => 'required|numeric',
It only allows numbers, but I need to add "-" and "/", how to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2018-06-20
@alexey-m-ukolov

Write your own validator .

I
iljaGolubev, 2018-06-20
@iljaGolubev

rule-regex

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question