MakerController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 11 1
A show() 0 16 1
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Http\Controllers;
9
10
use App\Models\Game;
11
use App\Models\Maker;
12
13
class MakerController extends Controller
14
{
15
    public function index($orderby = 'title', $direction = 'asc')
16
    {
17
        $makers = Maker::orderBy($orderby, $direction)
18
            ->paginate(25);
19
20
        return view('maker.index', [
21
            'makers'    => $makers,
22
            'orderby'   => $orderby,
23
            'direction' => $direction,
24
        ]);
25
    }
26
27
    public function show($makerid, $orderby = 'title', $direction = 'asc')
28
    {
29
        $games = Game::where('maker_id', '=', $makerid)
30
            ->orderBy($orderby, $direction)
31
            ->paginate(20);
32
33
        $maker = Maker::whereId($makerid)->first();
34
35
        return view('maker.show', [
36
            'games'     => $games,
37
            'maker'     => $maker,
38
            'orderby'   => $orderby,
39
            'direction' => $direction,
40
            'id'        => $makerid,
41
        ]);
42
    }
43
}
44