1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Laravelでパンくずリストを使う

Posted at

参考サイト

diglactic/laravel-breadcrumbsというパッケージが便利
Composerでインストール
composer require diglactic/laravel-breadcrumbs

パンくずリストを定義するファイルを作成

routes/breadcrumbs.php
<?php
// Home
Breadcrumbs::for('home', function ($trail) {
    $trail->push('Home', route('home'));
});

route('home')がルーティングのname。
なので、web.phpのルーティングの設定でnameがつけられてないとエラーになる。
以下のようにnameをつける

routes/web.php
Route::get('/', [App\Http\Controllers\CookController::class, 'index'])->name('home');
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?