如何在Laravel 5.2中调用有价值的路线?

I have a datatable and I want to go to detail data page when I click the Data ID

<td><a href= "{{ route('ReservationDetail') }}" >{{ $getData->ID }}</a></td>

But I don't know how to add the ID inside the route in a view. In my controller I have a function like this below

return Redirect('ReservationDetail?ID='.$reservation->ID);

when I trying to make like that in my view, I always get error.

<td><a href= "{{ route("ReservationDetail?ID='.$getData->ID'") }}" >{{ $getData->ID }}</a></td>

ErrorException in UrlGenerator.php line 307: Route [ReservationDetail?ID='.3'] not defined

your error is : Route [ReservationDetail?ID='.3'] not defined means it is failed to finding this route.

check php artisan route:list in your terminal , and see is there any route exists with ReservationDetail name.

if not then try to add in your web.php

Route::get('/ReservationDetail',ReservationDetailController@get_by_id)->name('ReservationDetail');

try this in your ReservationDetailController :

function get_by_id($ID){
     $getData = ReservationDetail::where('ID',$ID)->first();
     return view('detail',compact('getData'));
}

in your blade view :

<a href= "{{ route('ReservationDetail', ['ID' => $getData->ID] ) }}">{{ $getData->ID }}</a></td>

Use url() helper function.

<td><a href= "{{ url("ReservationDetail?ID='.$getData->ID'") }}" >{{ $getData->ID }}</a></td>