I’m new to laravel..
and i got an error
Route [student] not defined.
this is the code in my view
`
<a href="{{ route('student', $student->id) }}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline hover:text-blue-800 dark:hover:text-blue-400">
detail
</a>
`
this is the code in my controller
Route::get('/student/{id}', [
'as' => 'student',
StudentController::class,
'ShowDetail',
]);
how do i fix it?
sorry my english is not very good, i don’t know how to explain it
but
I want when "detail" is clicked it will move page to student/id or ( student/123 ) with id ,
then on the next page, it will display student data based on the id that was brought earlier
>Solution :
Try using
Route::get('/student/{id}', [StudentController::class, 'ShowDetail'])->name('student');
And calling the route with
<a href="{{ route('student', ['id' => $student->id]) }}"