T
T
The Dragger2016-09-20 15:34:24
Laravel
The Dragger, 2016-09-20 15:34:24

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

route:

Route::get('films/form/{id}', '[email protected]');

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

view:
<h1>Фильмы <a href="{{ action('Backend\[email protected]') }}">Create></a></h1>

Page error:
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)

Who has already experienced this? and how did you solve this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Pochepko, 2016-09-20
@IPD2

Route::get('films/form/{id?}', '[email protected]');

laravel.su/docs/5.0/routing#route-parameters

A
Alexey Ukolov, 2016-09-20
@alexey-m-ukolov

how did you solve this problem?
Read the documentation .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question