LogoComposer::compose()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Http\ViewComposers;
9
10
use Illuminate\Contracts\View\View;
11
12
class LogoComposer
13
{
14
    public function __construct()
15
    {
16
    }
17
18
    /**
19
     * Bind data to the view.
20
     *
21
     * @param View $view
22
     *
23
     * @return void
24
     */
25
    public function compose(View $view)
26
    {
27
        //$logo = Logo::inRandomOrder()->take(1)->get()->first();
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
        $logo = \DB::table('logos')
29
            ->leftJoin('users', 'logos.user_id', '=', 'users.id')
30
            ->leftJoin('logo_votes', 'logos.id', '=', 'logo_votes.logo_id')
31
            ->select(['logos.title', 'logos.filename', 'users.name', 'users.id'])
32
            ->whereRaw('(logo_votes.up - logo_votes.down) > 0')
33
            ->inRandomOrder()
34
            ->first();
35
36
        $view->with('logo', $logo);
37
    }
38
}
39