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

ShowController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 13 1
1
<?php
2
3
namespace Coyote\Http\Controllers\Guide;
4
5
use Coyote\Http\Resources\GuideResource;
6
use Coyote\Guide;
7
use Coyote\Services\UrlBuilder;
8
9
class ShowController extends BaseController
10
{
11
    public function index(Guide $guide)
12
    {
13
        $this->breadcrumb->push($guide->title, UrlBuilder::guide($guide));
14
15
        $guide->loadCount('comments');
16
        $guide->load(['commentsWithChildren', 'subscribers', 'assets']);
17
        $guide->loadUserVoterRelation($this->userId);
18
        $guide->loadUserRoleRelation($this->userId);
19
20
        GuideResource::withoutWrapping();
21
22
        return $this->view('guide.show', [
23
            'guide'         => (new GuideResource($guide))->toResponse($this->request)->getData(true)
24
        ]);
25
    }
26
}
27