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

Laravel – Route [student] not defined

I’m new to laravel..

and i got an error

Route [student] not defined.

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

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]) }}"
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