How to pass a parameter to the method (Laravel 5.3)?

route:
Route::get('films/form/{id}', 'FilmsController@getForm');

Controller:
class Controller extends FilmsController
{
 public function getForm($id = null)
{
 echo "True";
 }

view:
<h1>Movies <a href="{{ action('Backend\FilmsController@getForm') }}">Create</a></h1>

Error on page:
ErrorException in UrlGenerationException.php line 17:
Missing required parameters for [Route: ] [URI: admin-panel/films/form/{id}]. (View: /home/alexander/SosProjects/cinema.local/resources/views/backend/films/index.blade.php)


Anyone have experience with this ? and how was this problem solved ?
July 4th 19 at 22:45
2 answers
July 4th 19 at 22:47
Solution
Route::get('films/form/{id?}', 'FilmsController@getForm');


laravel.su/docs/5.0/routing#route-parameters
July 4th 19 at 22:49
how was this problem solved ?
Read the documentation.

Find more questions by tags Laravel