How to Laravel route with Get to a specific method in a class

Routing to a specific controller method in Laravel is fun but only if you know the syntax. Here it is:

Route::get('/user', [UserController::class, 'index']);

Reference

https://laravel.com/docs/8.x/routing#basic-routing

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top