Completed
Push — master ( 4628d4...002236 )
by Jeremy
08:14
created

AdminController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
c 0
b 0
f 0
dl 0
loc 48
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A filemanager() 0 5 1
A index() 0 19 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Models\Sound;
6
use App\Models\Theme;
7
use App\Models\User;
8
use App\Services\SoundServices;
9
10
class AdminController extends Controller
11
{
12
    /**
13
     * Create a new controller instance.
14
     *
15
     * @return void
16
     */
17
    public function __construct()
18
    {
19
        $this->middleware('auth');
20
    }
21
22
    /**
23
     * Show the application dashboard.
24
     *
25
     * @return \Illuminate\View\View
26
     */
27
    public function index()
28
    {
29
        $sounds = Sound::sortedSounds()->get();
30
        $enabledSounds = Sound::enabledSounds()->sortedSounds()->get();
31
        $user = auth()->user();
32
        $users = User::all();
33
        $themes = Theme::enabledThemes()->get();
34
        $SoundFiledata = SoundServices::checkAndPullSoundsAndRecordings();
35
36
        $data = [
37
            'sounds'        => $sounds,
38
            'enabledSounds' => $enabledSounds,
39
            'user'          => $user,
40
            'users'         => $users,
41
            'themes'        => $themes,
42
        ];
43
        $data = array_merge($data, $SoundFiledata);
44
45
        return view('pages.dashboard', $data);
46
    }
47
48
    /**
49
     * Show the application filemanager.
50
     *
51
     * @return \Illuminate\View\View
52
     */
53
    public function filemanager()
54
    {
55
        $data = SoundServices::checkAndPullSoundsAndRecordings();
56
57
        return view('pages.filemanager', $data);
58
    }
59
}
60