Slim 3 withRedirect problem and parameters

I use Slim 3 and i want pass values to withRedirect

$app->get('/users/create/', function($request, $response, $args) use ($user){
    return $this->view->render($response, 'usuarios/crear.html', ['data'=> []]);
})->setName('root');

and I redirect

return $response->withRedirect($this->router->pathFor('root', ['data'=> $input]));

and redirect but no show the new data. thx for read!

Upvotes: 1

Views: 1311

Answers (1)

odan
odan

Reputation: 4970

The second parameter of the pathFor() method is for routes with named placeholders like /users/{id}.

The 3. parameter of pathFor($name, array $data = [], array $queryParams = []) is for the query parameters.

Example

return $response->withRedirect($this->router->pathFor('root', [], ['data'=> $input]));

Upvotes: 3

Related Questions