1 | <?php namespace Arcanesoft\Foundation\Http\Controllers\Admin\System; |
||
19 | class LogViewerController extends Controller |
||
20 | { |
||
21 | /* ----------------------------------------------------------------- |
||
22 | | Trait |
||
23 | | ----------------------------------------------------------------- |
||
24 | */ |
||
25 | |||
26 | use JsonResponses; |
||
27 | |||
28 | /* ----------------------------------------------------------------- |
||
29 | | Properties |
||
30 | | ----------------------------------------------------------------- |
||
31 | */ |
||
32 | |||
33 | /** |
||
34 | * The LogViewer instance. |
||
35 | * |
||
36 | * @var \Arcanedev\LogViewer\Contracts\LogViewer |
||
37 | */ |
||
38 | protected $logViewer; |
||
39 | |||
40 | /** |
||
41 | * Logs per page. |
||
42 | * |
||
43 | * @var int |
||
44 | */ |
||
45 | protected $perPage = 30; |
||
46 | |||
47 | /* ----------------------------------------------------------------- |
||
48 | | Constructor |
||
49 | | ----------------------------------------------------------------- |
||
50 | */ |
||
51 | |||
52 | /** |
||
53 | * LogViewerController constructor. |
||
54 | * |
||
55 | * @param \Arcanedev\LogViewer\Contracts\LogViewer $logViewer |
||
56 | */ |
||
57 | public function __construct(LogViewerContract $logViewer) |
||
66 | |||
67 | /* ------------------------------------------------------------------------------------------------ |
||
68 | | Main Functions |
||
69 | | ------------------------------------------------------------------------------------------------ |
||
70 | */ |
||
71 | |||
72 | /** |
||
73 | * Show the LogViewer Dashboard. |
||
74 | * |
||
75 | * @return \Illuminate\View\View |
||
76 | */ |
||
77 | public function index() |
||
89 | |||
90 | /** |
||
91 | * List all logs. |
||
92 | * |
||
93 | * @param \Illuminate\Http\Request $request |
||
94 | * |
||
95 | * @return \Illuminate\View\View |
||
96 | */ |
||
97 | public function listLogs(Request $request) |
||
120 | |||
121 | /** |
||
122 | * Show the log entries by date. |
||
123 | * |
||
124 | * @param \Arcanedev\LogViewer\Entities\Log $log |
||
125 | * |
||
126 | * @return \Illuminate\View\View |
||
127 | */ |
||
128 | public function show(Log $log) |
||
141 | |||
142 | /** |
||
143 | * Filter the log entries by date and level. |
||
144 | * |
||
145 | * @param \Arcanedev\LogViewer\Entities\Log $log |
||
146 | * @param string $level |
||
147 | * |
||
148 | * @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse |
||
149 | */ |
||
150 | public function showByLevel(Log $log, $level) |
||
168 | |||
169 | /** |
||
170 | * Show the log with the search query. |
||
171 | * |
||
172 | * @param \Arcanedev\LogViewer\Entities\Log $log |
||
173 | * @param string $level |
||
174 | * @param \Illuminate\Http\Request $request |
||
175 | * |
||
176 | * @return \Illuminate\View\View |
||
177 | */ |
||
178 | public function search(Log $log, $level = 'all', Request $request) |
||
190 | |||
191 | /** |
||
192 | * Download the log. |
||
193 | * |
||
194 | * @param \Arcanedev\LogViewer\Entities\Log $log |
||
195 | * |
||
196 | * @return \Symfony\Component\HttpFoundation\BinaryFileResponse |
||
197 | */ |
||
198 | public function download(Log $log) |
||
204 | |||
205 | /** |
||
206 | * Delete a log. |
||
207 | * |
||
208 | * @param \Arcanedev\LogViewer\Entities\Log $log |
||
209 | * |
||
210 | * @return \Illuminate\Http\JsonResponse |
||
211 | */ |
||
212 | public function delete(Log $log) |
||
231 | |||
232 | /* ----------------------------------------------------------------- |
||
233 | | Other Methods |
||
234 | | ----------------------------------------------------------------- |
||
235 | */ |
||
236 | |||
237 | /** |
||
238 | * Calculate the percentage. |
||
239 | * |
||
240 | * @param array $total |
||
241 | * @param array $names |
||
242 | * |
||
243 | * @return array |
||
244 | */ |
||
245 | private function calcPercentages(array $total, array $names) |
||
260 | } |
||
261 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: