Open movepixels opened 5 years ago
How about your input ? Can you show?
The request that gets sent is an simply array.
What specific code would you like to see?
I am using this as a guide.
https://medium.com/@kamerk22/the-smart-way-to-handle-request-validation-in-laravel-5e8886279271
And it mentions Laravel 5.6 I am using v 5.7
Hope that helps, or let me know specificaly code you want to see?
Thanks, Dave
Oh, i see. It's not show error alright ?
Make sure your function authorize()
return true. If still not work you should follow this instruction
It's easy to configuration. please try your best. Thanks
Yes its set:
public function authorize()
{
return true;
}
Is there anything other inside the formRequest other than the filters?
Same issue here. Using Laravel 5.8
Edit: It is working fine, had to make an adjustment as I was working with arrays.
Would you care to share your setup as I still have no luck.
@movepixels I do have the same issue, however without using $request->get('input')
it works, see #50
<?php
use Illuminate\Foundation\Http\FormRequest;
use Waavi\Sanitizer\Laravel\SanitizesInput;
class UpdateRequest extends FormRequest
{
use SanitizesInput;
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'string|min:1|max:255',
];
}
/**
* Filters to be applied to the input.
*
* @return array
*/
public function filters()
{
return [
'name' => 'trim|escape',
];
}
}
See https://laravel.com/docs/6.x/requests#retrieving-input
dd($request->name)); // escaped input (OK)
dd($request->input('name')); // escaped input (OK)
dd($request->get('name')); // unescaped input (not OK)
I can not get the filter to work in the FormRequest. I must be missing something.
Added
and
And simple function
Any input in the form for these fields remains untouched.
Must be something missing.