|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Gameap\Http\Controllers; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
|
6
|
|
|
use \Illuminate\Http\Response; |
|
7
|
|
|
use Gameap\Services\InfoService; |
|
8
|
|
|
use Gameap\Services\GlobalApi; |
|
9
|
|
|
use Gameap\Http\Requests\SendBugRequest; |
|
10
|
|
|
use Cache; |
|
11
|
|
|
|
|
12
|
|
|
class HomeController extends Controller |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* Create a new controller instance. |
|
16
|
|
|
* |
|
17
|
|
|
* @return void |
|
18
|
|
|
*/ |
|
19
|
|
|
public function __construct() |
|
20
|
|
|
{ |
|
21
|
|
|
$this->middleware('auth'); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Show the application dashboard. |
|
26
|
|
|
* |
|
27
|
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
28
|
|
|
*/ |
|
29
|
|
|
public function index() |
|
30
|
|
|
{ |
|
31
|
|
|
$latestVersion = Cache::remember('latestVersion', 3600, function () { |
|
32
|
|
|
return InfoService::latestRelease(); |
|
33
|
|
|
}); |
|
34
|
|
|
|
|
35
|
|
|
$modules = app()['modules']->getCached(); |
|
36
|
|
|
|
|
37
|
|
|
return view('home', compact('latestVersion', 'modules')); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Show help information (GameAP resources etc) |
|
42
|
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
43
|
|
|
*/ |
|
44
|
|
|
public function help() |
|
45
|
|
|
{ |
|
46
|
|
|
return view('help'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Report a bug |
|
51
|
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
52
|
|
|
*/ |
|
53
|
|
|
public function reportBug() |
|
54
|
|
|
{ |
|
55
|
|
|
$extensions = get_loaded_extensions(); |
|
56
|
|
|
return view('report_bug', compact('extensions')); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Send bug |
|
61
|
|
|
* |
|
62
|
|
|
* @param SendBugRequest $request |
|
63
|
|
|
* @return \Illuminate\Http\RedirectResponse |
|
64
|
|
|
* @throws \Gameap\Exceptions\Services\GlobalApiException |
|
65
|
|
|
*/ |
|
66
|
|
|
public function sendBug(SendBugRequest $request) |
|
67
|
|
|
{ |
|
68
|
|
|
GlobalApi::sendBug( |
|
69
|
|
|
$request->input('summary'), |
|
70
|
|
|
$request->input('description') |
|
71
|
|
|
); |
|
72
|
|
|
|
|
73
|
|
|
return redirect()->route('report_bug') |
|
74
|
|
|
->with('success', __('home.send_bug_success_msg')); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Upgrade panel page |
|
79
|
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
80
|
|
|
*/ |
|
81
|
|
|
public function update() |
|
82
|
|
|
{ |
|
83
|
|
|
$latestVersion = InfoService::latestRelease(); |
|
84
|
|
|
return view('update', compact('latestVersion')); |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|