简体   繁体   中英

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?

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM