J
J
Jedi2020-05-20 06:14:07
Laravel
Jedi, 2020-05-20 06:14:07

How to pass second optional parameter to router?

Too few arguments to function App\Http\Controllers\HomeController::showCar(), 1 passed and exactly 2 expected


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


Why is this happening? Help me decide, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-05-20
@PHPjedi

It does not need to be passed , it needs to be made optional , it is ... optional ...
public function showCar(Car $car, $id = null)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question