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
![]() |
|||
27 | |||
28 | } |
||
29 | |||
30 | } |
||
31 |