Test Failed
Push — feature-laravel-5.4 ( dbda8c...02b5b6 )
by Kirill
03:30
created

DocsController::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of laravel.su package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace App\Http\Controllers;
10
11
use App\Models\Docs;
12
use Illuminate\Contracts\View\View;
13
14
/**
15
 * Class DocsController.
16
 */
17
class DocsController extends Controller
18
{
19
    /**
20
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|View
21
     */
22
    public function index(): View
23
    {
24
        return view('page.docs.index', [
25
            'latest' => Docs::latest('updated_at')->take(10)->get()
26
        ]);
27
    }
28
29
    /**
30
     * @param string $version
31
     * @param string $slug
32
     * @return View
33
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|View
34
     */
35
    public function show(string $version, string $slug): View
36
    {
37
        $docs = Docs::where('version', $version)->where('slug', $slug)->firstOrFail();
38
39
        return view('page.docs.show', [
40
            'docs' => $docs
41
        ]);
42
    }
43
}