Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Missing required parameter for [Route: building.floors] [URI: building/{building}/floors]

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');

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

Just a guess but should ['id' => $building->id] be ['building' => $building->id] (because building is the name of the variable in the route)?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading