Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 - Redirect::route with parameters

Tags:

php

laravel

Is it possible to specify a Redirect::route to a Resource Controller with parameters and specify how the parameters are handled?

I have the following route defined:

Route::resource('account','AccountController');

In another route I want to be able to pass parameters to account.create with values acquired earlier so I can pre-populate the create form, but want them passed using as a POST request.

Redirect::route('account.create',array('name' => $name));

The above works, but passes the parameters as a GET request.

like image 793
Chris Campbell Avatar asked Sep 10 '13 19:09

Chris Campbell


1 Answers

Redirect::route('account.create')->with('name', $name);

This'll flash it to the session, which you would then retrieve after the redirect with Session::get('name').

like image 99
Joseph Silber Avatar answered Nov 07 '22 03:11

Joseph Silber