|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Gameap\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use Gameap\Exceptions\GameapException; |
|
6
|
|
|
use Gameap\Http\Controllers\AuthController; |
|
7
|
|
|
use Gameap\Models\ClientCertificate; |
|
8
|
|
|
use Gameap\Repositories\ClientCertificateRepository; |
|
9
|
|
|
use Gameap\Http\Requests\ClientCertificatesRequest; |
|
10
|
|
|
|
|
11
|
|
|
class ClientCertificatesController extends AuthController |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* The ClientCertificateRepository instance. |
|
15
|
|
|
* |
|
16
|
|
|
* @var \Gameap\Repositories\ClientCertificateRepository |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $repository; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Create a new ClientCertificatesController instance. |
|
22
|
|
|
* |
|
23
|
|
|
* @param \Gameap\Repositories\ClientCertificateRepository $repository |
|
24
|
|
|
*/ |
|
25
|
|
|
public function __construct(ClientCertificateRepository $repository) |
|
26
|
|
|
{ |
|
27
|
|
|
parent::__construct(); |
|
28
|
|
|
|
|
29
|
|
|
$this->repository = $repository; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Display a listing of the resource. |
|
34
|
|
|
* |
|
35
|
|
|
* @return \Illuminate\Http\Response |
|
36
|
|
|
*/ |
|
37
|
|
|
public function index() |
|
38
|
|
|
{ |
|
39
|
|
|
$clientCertificates = $this->repository->getAll(); |
|
40
|
|
|
|
|
41
|
|
|
return view('admin.client_certificates.list', compact('clientCertificates')); |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Show the form for creating a new resource. |
|
46
|
|
|
* |
|
47
|
|
|
* @return \Illuminate\View\View |
|
48
|
|
|
*/ |
|
49
|
|
|
public function create() |
|
50
|
|
|
{ |
|
51
|
|
|
return view('admin.client_certificates.create', compact('clientCertificates')); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Store a newly created resource in storage. |
|
56
|
|
|
* |
|
57
|
|
|
* @param \Gameap\Http\Requests\ClientCertificatesRequest $request |
|
58
|
|
|
* @return \Illuminate\Http\RedirectResponse |
|
59
|
|
|
*/ |
|
60
|
|
|
public function store(ClientCertificatesRequest $request) |
|
61
|
|
|
{ |
|
62
|
|
|
try { |
|
63
|
|
|
$this->repository->store($request); |
|
64
|
|
|
|
|
65
|
|
|
return redirect()->route('admin.client_certificates.index') |
|
66
|
|
|
->with('success', __('client_certificates.create_success_msg')); |
|
67
|
|
|
} catch (GameapException $e) { |
|
68
|
|
|
return redirect()->back() |
|
69
|
|
|
->withErrors([$e->getMessage()]); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Display the specified resource. |
|
75
|
|
|
* |
|
76
|
|
|
* @param \Gameap\Models\ClientCertificate $clientCertificate |
|
77
|
|
|
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory |
|
78
|
|
|
*/ |
|
79
|
|
|
public function show(ClientCertificate $clientCertificate) |
|
80
|
|
|
{ |
|
81
|
|
|
$certificateInfo = $this->repository->certificateInfo($clientCertificate); |
|
82
|
|
|
|
|
83
|
|
|
return view('admin.client_certificates.view', compact('clientCertificate', 'certificateInfo')); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Remove the specified resource from storage. |
|
88
|
|
|
* |
|
89
|
|
|
* @param \Gameap\Models\ClientCertificate $clientCertificate |
|
90
|
|
|
* @return \Illuminate\Http\RedirectResponse |
|
91
|
|
|
*/ |
|
92
|
|
|
public function destroy(ClientCertificate $clientCertificate) |
|
93
|
|
|
{ |
|
94
|
|
|
$this->repository->destroy($clientCertificate); |
|
95
|
|
|
|
|
96
|
|
|
return redirect()->route('admin.client_certificates.index') |
|
97
|
|
|
->with('success', __('client_certificates.delete_success_msg')); |
|
98
|
|
|
} |
|
99
|
|
|
} |