@@ 22-51 (lines=30) @@ | ||
19 | * |
|
20 | * @return Response |
|
21 | */ |
|
22 | public function index() |
|
23 | { |
|
24 | try { |
|
25 | $error = false; |
|
26 | $statusCode = 200; |
|
27 | $title = 'Success'; |
|
28 | $type = 'success'; |
|
29 | $message = 'Success'; |
|
30 | $result = EpormasCounter::whereNull('deleted_at') |
|
31 | ->with('getCity') |
|
32 | ->with('getCategory') |
|
33 | ->get(); |
|
34 | } catch (Exception $e) { |
|
35 | $error = true; |
|
36 | $statusCode = 404; |
|
37 | $title = 'Error'; |
|
38 | $type = 'error'; |
|
39 | $message = 'Error'; |
|
40 | $result = 'Not Found'; |
|
41 | } finally { |
|
42 | return Response::json(array( |
|
43 | 'error' => $error, |
|
44 | 'status' => $statusCode, |
|
45 | 'title' => $title, |
|
46 | 'type' => $type, |
|
47 | 'message' => $message, |
|
48 | 'result' => $result |
|
49 | )); |
|
50 | } |
|
51 | } |
|
52 | ||
53 | /** |
|
54 | * Show the form for creating a new resource. |
|
@@ 199-228 (lines=30) @@ | ||
196 | * @param int $id |
|
197 | * @return Response |
|
198 | */ |
|
199 | public function show($version='', $id) |
|
200 | { |
|
201 | try { |
|
202 | $error = false; |
|
203 | $statusCode = 200; |
|
204 | $title = 'Success'; |
|
205 | $type = 'success'; |
|
206 | $message = 'Success'; |
|
207 | $result = EpormasCounter::whereNull('deleted_at') |
|
208 | ->with('getCity') |
|
209 | ->with('getCategory') |
|
210 | ->find($id); |
|
211 | } catch (Exception $e) { |
|
212 | $error = true; |
|
213 | $statusCode = 404; |
|
214 | $title = 'Error'; |
|
215 | $type = 'error'; |
|
216 | $message = 'Error'; |
|
217 | $result = 'Not Found'; |
|
218 | } finally { |
|
219 | return Response::json(array( |
|
220 | 'error' => $error, |
|
221 | 'status' => $statusCode, |
|
222 | 'title' => $title, |
|
223 | 'type' => $type, |
|
224 | 'message' => $message, |
|
225 | 'result' => $result |
|
226 | )); |
|
227 | } |
|
228 | } |
|
229 | ||
230 | /** |
|
231 | * Show the form for editing the specified resource. |