Completed
Push — master ( 723848...f6a9f3 )
by Yaro
05:45
created

BreadcrumbsTrait::breadcrumbs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Yaro\Jarboe\Http\Controllers\Traits;
4
5
use Illuminate\Support\Facades\View;
6
use Yaro\Jarboe\ViewComponents\Breadcrumbs\BreadcrumbsInterface;
7
8
trait BreadcrumbsTrait
9
{
10
    protected $breadcrumbs;
11
12
    public function breadcrumbs(): BreadcrumbsInterface
13
    {
14
        return $this->breadcrumbs;
15
    }
16
17 33
    protected function initBreadcrumbs()
18
    {
19
        View::composer('jarboe::crud.list', function ($view) {
20
            $view->with('breadcrumbs', $this->breadcrumbs());
21 33
        });
22
        View::composer('jarboe::crud.create', function ($view) {
23
            $view->with('breadcrumbs', $this->breadcrumbs());
24 33
        });
25
        View::composer('jarboe::crud.edit', function ($view) {
26
            $view->with('breadcrumbs', $this->breadcrumbs());
27 33
        });
28 33
    }
29
}
30