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

ShowController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 13
rs 10
c 0
b 0
f 0
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