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

BreadcrumbsTrait::initBreadcrumbs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0527

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 8
cp 0.625
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1.0527
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