Skip to content
Snippets Groups Projects
Commit 019e1d23 authored by Alex's avatar Alex
Browse files

Correct User Validator to work with PHP 7.3+. It is because of PCRE version used in PHP. Fix #22

parent abe1866a
No related branches found
No related tags found
No related merge requests found
Pipeline #5042 passed
......@@ -3,6 +3,7 @@
/public/storage
/storage/*.key
/vendor
/.idea
.env
.env.backup
.phpunit.result.cache
......
......@@ -24,7 +24,10 @@ class UserController extends Controller
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|regex:/^[a-zA-Z0-9\s-\.]+$/|max:255',
//Works for PHP < 7.3
//'name' => 'required|string|regex:/^[a-zA-Z0-9_\s-\.]+$/|max:255',
//works for PHP7.3 and newer, the previous one no.
'name' => 'required|string|regex:/^[a-zA-Z0-9_\s.]+$/|max:255',
'email' => 'required|email'
]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment