Recently I discovered when I use the prepareForValidation function in my form request, the rule (required) does not adhere
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => ['required', 'unique:permissions'],
];
}
and the protected function
protected function prepareForValidation()
{
$this->merge([
'name' => Str::of($this->name)->title()->plural(),
]);
}
in other words I would like my inputs have a standard fromart
@kevinwakhisi I think it's because Str::of($this->name)->title()->plural() returns Stringable object (so param is an object, and required rule passes). try to add __toString() at the end