Passed
Pull Request — master (#46)
by
unknown
04:36
created

DashboardController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 17
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 10 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Tournament;
6
use Carbon\Carbon;
7
use Illuminate\Support\Facades\Auth;
8
use Illuminate\Support\Facades\View;
9
10
class DashboardController extends Controller
11
{
12
    /**
13
     * Display a listing of the resource.
14
     *
15
     * @return View
16
     */
17 8
    public function index()
18
    {
19 8
        $openTournaments = Tournament::with('owner')
20 8
            ->whereHas('owner', function ($query) {
21 8
                $query->where('country_id', Auth::user()->country_id);
22 8
            })
23 8
            ->where('type', config('constants.OPEN_TOURNAMENT'))
24 8
            ->where('dateFin', '>', Carbon::today()->toDateString())
25 8
            ->get();
26 8
        return view('/dashboard', compact('openTournaments'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('/dashboard'...act('openTournaments')) returns the type Illuminate\Contracts\Vie...ry|Illuminate\View\View which is incompatible with the documented return type Illuminate\Support\Facades\View.
Loading history...
27
28
    }
29
30
}
31