1. Go to this page and download the library: Download falur/laravel-breadcrumbs 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/ */
// BaseController.php
class BaseController extends Controller
{
/**
* @var Falur\Breadcrumbs\Contracts\Breadcrumbs
*/
protected $breadcrumbs;
public function __construct(Falur\Breadcrumbs\Contracts\Breadcrumbs $breadcrumbs)
{
$this->breadcrumbs->add('Главная', '/');
}
}
// PageController.php
class PageController extends BaseController
{
public function action()
{
$this->breadcrumbs->add('Action', '/action');
}
}
// PageController.php
class PageController extends Controller
{
public function action(Falur\Breadcrumbs\Contracts\Breadcrumbs $breadcrumbs)
{
$breadcrumbs->addArray([
new BreadcrumbsItem('Home', '/'),
new BreadcrumbsItem('Action', '/action'),
]);
}
}