Tino
Tino

Reputation: 3368

Post Request Routing Laravel 4

I would like to tell a route to get the post request from a form. The post request looks like this:

/product/dashboard?from=2013-09-17&to=2013-09-17

My Route looks like this:

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

What am I doing wrong or what should I do differently.

Upvotes: 0

Views: 108

Answers (1)

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87719

This is the way RESTful urls work in Laravel 4:

Route::post('/product/dashboard/{from}/{to?}', function($from, $to = "")
    {
        return "$from $to";
    });

And your request should be:

/product/dashboard/2013-09-17/2013-09-17

Or just

/product/dashboard/2013-09-17

Upvotes: 1

Related Questions