route only laravel code example

Example 1: laravel route controller

use App\Http\Controllers\UserController;

Route::get('user/{id}', [UserController::class, 'show']);

Example 2: laravel route

Route::view('/welcome', 'welcome');

Route::view('/welcome', 'welcome', ['name' => 'Taylor']);

Example 3: controller in laravel 8

Rout::get('/test' , [TestController::class , 'index']);

Example 4: laravel route

Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
    //
});

Tags:

C Example