Passed
Push — master ( 3b518a...cd2a02 )
by Adam
11:23
created

BaseController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A view() 0 4 1
1
<?php
2
3
namespace Coyote\Http\Controllers\Guide;
4
5
use Coyote\Guide;
6
use Coyote\Http\Controllers\Controller;
7
use Coyote\Http\Resources\TagResource;
8
use Coyote\Repositories\Contracts\TagRepositoryInterface as TagRepository;
9
10
abstract class BaseController extends Controller
11
{
12
    public function __construct(protected TagRepository $tagRepository)
13
    {
14
        parent::__construct();
15
16
        TagResource::urlResolver(fn (string $name) => route('guide.tag', [urlencode($name)]));
17
18
        $this->breadcrumb->push('Rekrutacyjne Q&A', route('guide.home'));
19
    }
20
21
    public function view($view = null, $data = [])
22
    {
23
        return parent::view($view, $data)->with([
24
            'popular_tags'  => $this->tagRepository->popularTags(Guide::class)->groupBy('category')
25
        ]);
26
    }
27
}
28