1. Go to this page and download the library: Download web-id/breadcrumb library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use WebId\Breadcrumb\Breadcrumb;
class BlogBreadcrumb extends Breadcrumb
{
public function index(): array
{
return $this->render(
$this->baseBreadcrumb()
->add('Blog')
->tree()
);
}
}
public function show(Post $post): array
{
return $this->render(
$this->baseBreadcrumb()
->add('Blog', route('blog.index'))
->add($post->title, route('blog.show', ['post' => $post]))
->tree()
);
}