gzai
3 months ago
529
8
Laravel

Calling validation FormRequest from controller is sometimes incorrect

Posted 3 months ago by gzai

Hello,

I have FormRequest, and I want to call FormRequest in other api controller

controller :


$request_tasks = app('App\Requests\TasksRequest');
$request_tasks->setValidator( Validator::make( $request->all(), $request_tasks->rules(), $request_tasks->messages() ) );

$result = $this->create( $request_tasks->validated() );

The process validation is correct, but sometime validation incorrect for some rule. does anyone know the issue?

Please sign in or create an account to participate in this conversation.