|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Gameap\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use Gameap\Exceptions\Repositories\GdaemonTaskRepository\GdaemonTaskRepositoryException; |
|
6
|
|
|
use \Gameap\Http\Controllers\AuthController; |
|
7
|
|
|
use \Gameap\Repositories\GdaemonTaskRepository; |
|
8
|
|
|
use \Gameap\Models\GdaemonTask; |
|
9
|
|
|
|
|
10
|
|
|
class GdaemonTasksController extends AuthController |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* The GdaemonTasksRepository instance. |
|
14
|
|
|
* |
|
15
|
|
|
* @var \Gameap\Repositories\GdaemonTaskRepository |
|
16
|
|
|
*/ |
|
17
|
|
|
protected $repository; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Create a new GdaemonTasksController instance. |
|
21
|
|
|
* |
|
22
|
|
|
* @param \Gameap\Repositories\GdaemonTaskRepository $repository |
|
23
|
|
|
*/ |
|
24
|
15 |
|
public function __construct(GdaemonTaskRepository $repository) |
|
25
|
|
|
{ |
|
26
|
15 |
|
parent::__construct(); |
|
27
|
|
|
|
|
28
|
15 |
|
$this->repository = $repository; |
|
29
|
15 |
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Display a listing of the games. |
|
33
|
|
|
* |
|
34
|
|
|
* @return \Illuminate\View\View |
|
35
|
|
|
*/ |
|
36
|
6 |
|
public function index() |
|
37
|
|
|
{ |
|
38
|
6 |
|
return view('admin.gdaemon_tasks.list',[ |
|
39
|
6 |
|
'gdaemonTasks' => $this->repository->getAll() |
|
40
|
|
|
]); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Display the specified resource. |
|
45
|
|
|
* |
|
46
|
|
|
* @param \Gameap\Models\GdaemonTask $gdaemonTask |
|
47
|
|
|
* @return \Illuminate\View\View |
|
48
|
|
|
*/ |
|
49
|
6 |
|
public function show(GdaemonTask $gdaemonTask) |
|
50
|
|
|
{ |
|
51
|
6 |
|
return view('admin.gdaemon_tasks.view', compact('gdaemonTask')); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @param GdaemonTask $gdaemonTask |
|
56
|
|
|
*/ |
|
57
|
3 |
|
public function cancel(GdaemonTask $gdaemonTask) |
|
58
|
|
|
{ |
|
59
|
|
|
try { |
|
60
|
3 |
|
$this->repository->cancel($gdaemonTask); |
|
61
|
3 |
|
} catch (GdaemonTaskRepositoryException $exception) { |
|
62
|
3 |
|
return redirect()->route('admin.gdaemon_tasks.show', $gdaemonTask->getKey()) |
|
63
|
3 |
|
->with('error', __('gdaemon_tasks.canceled_fail_msg', [ |
|
64
|
3 |
|
'error' => $exception->getMessage(), |
|
65
|
|
|
])); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
return redirect()->route('admin.gdaemon_tasks.show', $gdaemonTask->getKey()) |
|
69
|
|
|
->with('success', __('gdaemon_tasks.canceled_success_msg')); |
|
70
|
|
|
} |
|
71
|
|
|
} |