Laravel: route with parameters

Asked

Viewed 2,482 times

3

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 the date (chamadas/index). This form will redirect to a screen with the list of students of the chosen class to launch the call on the day previously selected.

How should I set up a route that agrees to receive something like chamadas?turma=1&data=21-08-2017 ?

Even if there is a way in which the parameters do not appear in the url for me already serves.

Thanks in advance.

1 answer

3

As simple as possible, example:

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

in your class controller

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

your url that would be it:

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

References

  • Did not work :( Shows missing route

  • @Matheus your route is one link or a post? This message is because you are doing something that the application is not configured correctly, would you like me to edit your question and tell you what you did... ??? If possible put all routes and which route you are using ???

Browser other questions tagged

You are not signed in. Login or sign up in order to post.