Asked by: SheppardDigital
I have a field in a form which accepts a username. I need to use Laravels validation to validate the username but I'm struggling to come up with a solution which allows both alpha and numeric characters, but does not allow spaces in the username.
My Current validator looks like this;
$validatorFields = [
'name' => 'required|string|max:150|regex:/^[A-Za-z0-9\-\s]+$/'
];
Can anyone suggest how to do this please?
No comments:
Post a Comment