'Laravel validate "required" rule
In class TrimStrings i was added passsword or new_password to except field not trim:
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
'new_password'
];
}
In method rule of Request, i still get value of new_password not trim. But when use required rule in laravel:
'new_password' => [
'string',
'required',
'max:255'
],
but it seems that when using the required rule it still automatically trims my string before validating. Is there a way for them not to do that? Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
