ルーティングに名前を付ける

【web.php
例)
Route::get('/', [PostController::class, 'index'])
    ->name('posts.index');

Route::get('/posts/{id}', [PostController::class, 'show'])
     ->name('posts.show');

【view】
例)
 &laquo; <a href="/">Back</a>

 &laquo; <a href="{{ route('posts.index') }}">Back</a>

 

<a href="/posts/{{ $index }}">

 <a href="{{ route('posts.show', $index) }}">

参考:ドットインストール「Laravel 8入門 基本機能編」