Reputation: 10095
Route Code
Route::get(
'/product-{name}',
[
ProductDetailsController::class, "showProductDetailsMainForm"
]
)->name("showProductDetailsMainForm");
Usage
<a href="{!! route('showProductDetailsMainForm', 'name' => 'hello') !!}">
Error Details
Missing required parameters for [Route: showProductDetailsMainForm] [URI: product-{name}]
Am I missing anything?
Upvotes: 0
Views: 108
Reputation: 34678
For single parameter, you can define like this (without mention the parameter name) :
{{ route('showProductDetailsMainForm', 'hello') }}
Or, with mention the parameter name :
{{ route('showProductDetailsMainForm', ['name' => 'hello']) }}
And change Route::get('/product-{name}',…
to Route::get('/product/{name}',…
Upvotes: 1
Reputation: 12835
Try
Route::get(
'/product/{name}',
[
ProductDetailsController::class, "showProductDetailsMainForm"
]
)->name("showProductDetailsMainForm");
In view
<a href="{{ route('showProductDetailsMainForm', ['name' => 'hello']) }}">
Upvotes: 1
Reputation: 1731
You should use route('showProductDetailsMainForm', ['name' => 'hello']);
Upvotes: 2