Package Data | |
---|---|
Maintainer Username: | gian_tiaga |
Maintainer Contact: | ienakaev@ya.ru (Ildar Enakaev) |
Package Create Date: | 2017-03-02 |
Package Last Update: | 2017-03-16 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:12:30 |
Package Statistics | |
---|---|
Total Downloads: | 6,719 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
composer require falur/laravel-breadcrumbs
config/app.php
К providers
Falur\Breadcrumbs\Providers\ServiceProvider::class
К aliases
'Breadcrumbs' => Falur\Breadcrumbs\Facades\Breadcrumbs::class,
'BreadcrumbsFactory' => Falur\Breadcrumbs\Facades\BreadcrumbsFactory::class,
// 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'),
]);
}
}
В отображении
// view.blade.php
{!! Breadcrumbs::render() !!}
Либо
php artisan vendor:publish --provider="Falur\Breadcrumbs\Providers\ServiceProvider"
После чего в каталоге vendor
появится шаблон хлебных крошек
Либо
Breadcrumbs::setViewPath($path);
Breadcrumbs::setTemplate($template);
Где $path
- путь к шаблону $template
- сам шаблон