php – Laravel: route with parameters

Question:

I have a school system with a call screen where there is a button that opens a modal with a form to choose the class and date ( chamadas/index ). This form will redirect to a screen with the list of students in the class chosen to launch the call on the day previously selected.

How should I build a route that accepts receiving something like chamadas?turma=1&data=21-08-2017 ?

Even if there is a way in which the parameters don't appear in the url, it's fine for me.

Thank you very much in advance.

Answer:

As simple as possible, example :

Route::get('chamadas/{turma}/{data}', "ChamadasController@index");

in your controller class

class ChamadasController 
{
    public function index($turma, $data)
    {
         // ... code
    }
}

your url would be this:

http://site.com/chamadas/1/21-08-2017

Referencias

Scroll to Top