I need your help. How can I write in the following href using route?
I have the following route:
Route::get('/building/{building}/floors', [BuildingController::class, 'floors'])->name('building.floors');
In the view I have:
<td><a href="{{URL::to('/building/' . $building->id . '/floors') }}" class="link-primary">{{ $building->floors }}</a></td>
I tried to write it in the following way
<td><a href="{{route('building.floors' , ['id' => $building->id])}}" class="link-primary">{{ $building->floors }}</a></td>
but I get the error Missing required parameter for [Route: building.floors] [URI: building/{building}/floors].
Can anyone kindly help me?
Just a guess but should ['id' => $building->id]
be ['building' => $building->id]
(because building
is the name of the variable in the route)?