Tino
Tino

Reputation: 3368

Laravel Passing Variables to Controller

I have a post route set up like this:

Route::post('/product/dashboard', function()
    {
        $from = Input::get('from');
        $to = Input::get('to');

    });

And now I would like to pass those to a controller.

I call controllers like this normally:

Route::get('/', 'HomeController@showWelcome');

How would I go on to that with variables?

Upvotes: 0

Views: 2123

Answers (1)

J.T. Grimes
J.T. Grimes

Reputation: 4272

Why not access the Input variables from within the controller?

Route::post('product/dashboard', 'HomeController@showDashboard');

and in the controller...

function showDashboard() {
   $from = Input::get('from');
   $to = Input::get('to');

   // do more stuff
}

Upvotes: 2

Related Questions