Passed
Push — master ( c7379f...97417c )
by Esza
02:29
created
src/Http/Controllers/EpormasCategoryController.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
    *
68 68
    * @return Response
69 69
    */
70
-  public function store(Request $request, $version='')
70
+  public function store(Request $request, $version = '')
71 71
   {
72 72
         $path = \Request::path();
73 73
         $explode = explode('/', $path);
74 74
 
75 75
         $from = 'form';
76
-        if(in_array('api',$explode)){
76
+        if (in_array('api', $explode)) {
77 77
           $from = 'api';
78 78
         }
79 79
 
80 80
         $via = $from;
81
-        if($version != '' && $version != 'store'){
81
+        if ($version != '' && $version != 'store') {
82 82
           $via .= '-'.$version;
83 83
         }
84 84
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $data = EpormasCategory::whereNull('deleted_at')
99 99
                         ->where('name', $request->name)
100 100
                         ->count();
101
-        if($data > 0){
101
+        if ($data > 0) {
102 102
           return Response::json(array(
103 103
               'title' => 'Error',
104 104
               'type'  => 'error',
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
    * @param  int  $id
148 148
    * @return Response
149 149
    */
150
-  public function show($version='', $id)
150
+  public function show($version = '', $id)
151 151
   {
152 152
         try {
153 153
             $error = false;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
    * @param  int  $id
230 230
    * @return Response
231 231
    */
232
-  public function update(Request $request, $version='', $id)
232
+  public function update(Request $request, $version = '', $id)
233 233
   {
234 234
         $result = EpormasCategory::find($id);
235 235
 
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
           ));
246 246
         }
247 247
 
248
-        if($request->name != $result->name){
248
+        if ($request->name != $result->name) {
249 249
           $data = EpormasCategory::whereNull('deleted_at')
250 250
                           ->where('name', $request->name)
251 251
                           ->count();
252
-          if($data > 0){
252
+          if ($data > 0) {
253 253
             return Response::json(array(
254 254
                 'title' => 'Error',
255 255
                 'type'  => 'error',
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
         $explode = explode('/', $path);
263 263
 
264 264
         $from = 'form';
265
-        if(in_array('api',$explode)){
265
+        if (in_array('api', $explode)) {
266 266
           $from = 'api';
267 267
         }
268 268
 
269 269
         $via = $from;
270
-        if($version != '' && $version != 'update'){
270
+        if ($version != '' && $version != 'update') {
271 271
           $via .= '-'.$version;
272 272
         }
273 273
 
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -12,91 +12,91 @@  discard block
 block discarded – undo
12 12
 class EpormasCategoryController extends Controller
13 13
 {
14 14
 
15
-  /**
16
-   * Display a listing of the resource.
17
-   *
18
-   * @return Response
19
-   */
20
-  public function index()
21
-  {
22
-      try {
23
-          $error = false;
24
-          $statusCode = 200;
25
-          $title = 'Success';
26
-          $type = 'success';
27
-          $message = 'Success';
28
-          $result = EpormasCategory::all();
29
-      } catch (Exception $e) {
30
-          $error = true;
31
-          $statusCode = 404;
32
-          $title = 'Error';
33
-          $type = 'error';
34
-          $message = 'Error';
35
-          $result = 'Not Found';
36
-      } finally {
37
-          return Response::json(array(
15
+    /**
16
+     * Display a listing of the resource.
17
+     *
18
+     * @return Response
19
+     */
20
+    public function index()
21
+    {
22
+        try {
23
+            $error = false;
24
+            $statusCode = 200;
25
+            $title = 'Success';
26
+            $type = 'success';
27
+            $message = 'Success';
28
+            $result = EpormasCategory::all();
29
+        } catch (Exception $e) {
30
+            $error = true;
31
+            $statusCode = 404;
32
+            $title = 'Error';
33
+            $type = 'error';
34
+            $message = 'Error';
35
+            $result = 'Not Found';
36
+        } finally {
37
+            return Response::json(array(
38 38
             'error' => $error,
39 39
             'status' => $statusCode,
40 40
             'title' => $title,
41 41
             'type' => $type,
42 42
             'message' => $message,
43 43
             'result' => $result
44
-          ));
45
-      }
46
-  }
44
+            ));
45
+        }
46
+    }
47 47
 
48
-  /**
49
-   * Show the form for creating a new resource.
50
-   *
51
-   * @return Response
52
-   */
53
-  public function create()
54
-  {
48
+    /**
49
+     * Show the form for creating a new resource.
50
+     *
51
+     * @return Response
52
+     */
53
+    public function create()
54
+    {
55 55
 
56
-  }
56
+    }
57 57
 
58
-  /**
59
-   * Store a newly created resource in storage.
60
-   *
61
-   * @return Response
62
-   */
63
-  public function store(Request $request, $version='')
64
-  {
58
+    /**
59
+     * Store a newly created resource in storage.
60
+     *
61
+     * @return Response
62
+     */
63
+    public function store(Request $request, $version='')
64
+    {
65 65
         $path = \Request::path();
66 66
         $explode = explode('/', $path);
67 67
 
68 68
         $from = 'form';
69 69
         if(in_array('api',$explode)){
70
-          $from = 'api';
70
+            $from = 'api';
71 71
         }
72 72
 
73 73
         $via = $from;
74 74
         if($version != '' && $version != 'store'){
75
-          $via .= '-'.$version;
75
+            $via .= '-'.$version;
76 76
         }
77 77
 
78
-      	$rules = [
78
+            $rules = [
79 79
             'name' => 'required'
80 80
         ];
81 81
 
82 82
         $validator = Validator::make($request->all(), $rules);
83 83
         if ($validator->fails()) {
84
-          return Response::json(array(
85
-              'title' => 'Error',
86
-              'type'  => 'error',
87
-              'message' => $validator->errors()->all()
88
-          ));
84
+            return Response::json(array(
85
+                'title' => 'Error',
86
+                'type'  => 'error',
87
+                'message' => $validator->errors()->all()
88
+            ));
89 89
         }
90 90
 
91 91
         $data = EpormasCategory::whereNull('deleted_at')
92 92
                         ->where('name', $request->name)
93 93
                         ->count();
94 94
         if($data > 0){
95
-          return Response::json(array(
96
-              'title' => 'Error',
97
-              'type'  => 'error',
98
-              'message' => 'Data has already been taken.'
99
-          ));
95
+            return Response::json(array(
96
+                'title' => 'Error',
97
+                'type'  => 'error',
98
+                'message' => 'Data has already been taken.'
99
+            ));
100 100
         }
101 101
 
102 102
         $error = false;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
             'name' => $request->name
109 109
         ]);
110 110
         return Response::json(array(
111
-          'error' => $error,
112
-          'status' => $statusCode,
113
-          'title' => $title,
114
-          'type' => $type,
115
-          'message' => $message,
116
-          'result' => $result
111
+            'error' => $error,
112
+            'status' => $statusCode,
113
+            'title' => $title,
114
+            'type' => $type,
115
+            'message' => $message,
116
+            'result' => $result
117 117
         ));
118
-  }
118
+    }
119 119
 
120
-  /**
121
-   * Display the specified resource.
122
-   *
123
-   * @param  int  $id
124
-   * @return Response
125
-   */
126
-  public function show($version='', $id)
127
-  {
120
+    /**
121
+     * Display the specified resource.
122
+     *
123
+     * @param  int  $id
124
+     * @return Response
125
+     */
126
+    public function show($version='', $id)
127
+    {
128 128
         try {
129 129
             $error = false;
130 130
             $statusCode = 200;
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
             $result = 'Not Found';
142 142
         } finally {
143 143
             return Response::json(array(
144
-              'error' => $error,
145
-              'status' => $statusCode,
146
-              'title' => $title,
147
-              'type' => $type,
148
-              'message' => $message,
149
-              'result' => $result
144
+                'error' => $error,
145
+                'status' => $statusCode,
146
+                'title' => $title,
147
+                'type' => $type,
148
+                'message' => $message,
149
+                'result' => $result
150 150
             ));
151 151
         }
152
-  }
152
+    }
153 153
 
154
-  /**
155
-   * Show the form for editing the specified resource.
156
-   *
157
-   * @param  int  $id
158
-   * @return Response
159
-   */
160
-  public function edit($id)
161
-  {
154
+    /**
155
+     * Show the form for editing the specified resource.
156
+     *
157
+     * @param  int  $id
158
+     * @return Response
159
+     */
160
+    public function edit($id)
161
+    {
162 162
         try {
163 163
             $error = false;
164 164
             $statusCode = 200;
@@ -175,24 +175,24 @@  discard block
 block discarded – undo
175 175
             $result = 'Not Found';
176 176
         } finally {
177 177
             return Response::json(array(
178
-              'error' => $error,
179
-              'status' => $statusCode,
180
-              'title' => $title,
181
-              'type' => $type,
182
-              'message' => $message,
183
-              'result' => $result
178
+                'error' => $error,
179
+                'status' => $statusCode,
180
+                'title' => $title,
181
+                'type' => $type,
182
+                'message' => $message,
183
+                'result' => $result
184 184
             ));
185 185
         }
186
-  }
186
+    }
187 187
 
188
-  /**
189
-   * Update the specified resource in storage.
190
-   *
191
-   * @param  int  $id
192
-   * @return Response
193
-   */
194
-  public function update(Request $request, $version='', $id)
195
-  {
188
+    /**
189
+     * Update the specified resource in storage.
190
+     *
191
+     * @param  int  $id
192
+     * @return Response
193
+     */
194
+    public function update(Request $request, $version='', $id)
195
+    {
196 196
         $result = EpormasCategory::find($id);
197 197
 
198 198
         $rules = [
@@ -201,23 +201,23 @@  discard block
 block discarded – undo
201 201
 
202 202
         $validator = Validator::make($request->all(), $rules);
203 203
         if ($validator->fails()) {
204
-          return Response::json(array(
205
-              'type'  => 'error',
206
-              'message' => $validator->errors()->all()
207
-          ));
204
+            return Response::json(array(
205
+                'type'  => 'error',
206
+                'message' => $validator->errors()->all()
207
+            ));
208 208
         }
209 209
 
210 210
         if($request->name != $result->name){
211
-          $data = EpormasCategory::whereNull('deleted_at')
212
-                          ->where('name', $request->name)
213
-                          ->count();
214
-          if($data > 0){
211
+            $data = EpormasCategory::whereNull('deleted_at')
212
+                            ->where('name', $request->name)
213
+                            ->count();
214
+            if($data > 0){
215 215
             return Response::json(array(
216 216
                 'title' => 'Error',
217 217
                 'type'  => 'error',
218 218
                 'message' => 'Data has already been taken.'
219 219
             ));
220
-          }
220
+            }
221 221
         }
222 222
 
223 223
         $path = \Request::path();
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 
226 226
         $from = 'form';
227 227
         if(in_array('api',$explode)){
228
-          $from = 'api';
228
+            $from = 'api';
229 229
         }
230 230
 
231 231
         $via = $from;
232 232
         if($version != '' && $version != 'update'){
233
-          $via .= '-'.$version;
233
+            $via .= '-'.$version;
234 234
         }
235 235
 
236 236
         $error = false;
@@ -242,37 +242,37 @@  discard block
 block discarded – undo
242 242
             'name' => $request->name
243 243
         ]);
244 244
         return Response::json(array(
245
-          'error' => $error,
246
-          'status' => $statusCode,
247
-          'title' => $title,
248
-          'type' => $type,
249
-          'message' => $message,
250
-          'result' => $result
245
+            'error' => $error,
246
+            'status' => $statusCode,
247
+            'title' => $title,
248
+            'type' => $type,
249
+            'message' => $message,
250
+            'result' => $result
251 251
         ));
252
-  }
252
+    }
253 253
 
254
-  /**
255
-   * Remove the specified resource from storage.
256
-   *
257
-   * @param  int  $id
258
-   * @return Response
259
-   */
260
-  public function destroy($id)
261
-  {
262
-      EpormasCategory::find($id)->delete();
263
-      $error = false;
264
-      $statusCode = 200;
265
-      $title = 'Success';
266
-      $type = 'success';
267
-      $message = 'Data deleted successfully';
268
-      return Response::json(array(
254
+    /**
255
+     * Remove the specified resource from storage.
256
+     *
257
+     * @param  int  $id
258
+     * @return Response
259
+     */
260
+    public function destroy($id)
261
+    {
262
+        EpormasCategory::find($id)->delete();
263
+        $error = false;
264
+        $statusCode = 200;
265
+        $title = 'Success';
266
+        $type = 'success';
267
+        $message = 'Data deleted successfully';
268
+        return Response::json(array(
269 269
         'error' => $error,
270 270
         'status' => $statusCode,
271 271
         'title' => $title,
272 272
         'type' => $type,
273 273
         'message' => $message
274
-      ));
275
-  }
274
+        ));
275
+    }
276 276
 
277 277
 }
278 278
 
Please login to merge, or discard this patch.
src/Http/Controllers/EpormasCityController.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
    *
68 68
    * @return Response
69 69
    */
70
-  public function store(Request $request, $version='')
70
+  public function store(Request $request, $version = '')
71 71
   {
72 72
         $path = \Request::path();
73 73
         $explode = explode('/', $path);
74 74
 
75 75
         $from = 'form';
76
-        if(in_array('api',$explode)){
76
+        if (in_array('api', $explode)) {
77 77
           $from = 'api';
78 78
         }
79 79
 
80 80
         $via = $from;
81
-        if($version != '' && $version != 'store'){
81
+        if ($version != '' && $version != 'store') {
82 82
           $via .= '-'.$version;
83 83
         }
84 84
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $data = EpormasCity::whereNull('deleted_at')
99 99
                         ->where('name', $request->name)
100 100
                         ->count();
101
-        if($data > 0){
101
+        if ($data > 0) {
102 102
           return Response::json(array(
103 103
               'title' => 'Error',
104 104
               'type'  => 'error',
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
    * @param  int  $id
148 148
    * @return Response
149 149
    */
150
-  public function show($version='', $id)
150
+  public function show($version = '', $id)
151 151
   {
152 152
         try {
153 153
             $error = false;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
    * @param  int  $id
230 230
    * @return Response
231 231
    */
232
-  public function update(Request $request, $version='', $id)
232
+  public function update(Request $request, $version = '', $id)
233 233
   {
234 234
         $result = EpormasCity::find($id);
235 235
 
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
           ));
247 247
         }
248 248
 
249
-        if($request->name != $result->name){
249
+        if ($request->name != $result->name) {
250 250
           $data = EpormasCity::whereNull('deleted_at')
251 251
                           ->where('name', $request->name)
252 252
                           ->count();
253
-          if($data > 0){
253
+          if ($data > 0) {
254 254
             return Response::json(array(
255 255
                 'title' => 'Error',
256 256
                 'type'  => 'error',
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
         $explode = explode('/', $path);
264 264
 
265 265
         $from = 'form';
266
-        if(in_array('api',$explode)){
266
+        if (in_array('api', $explode)) {
267 267
           $from = 'api';
268 268
         }
269 269
 
270 270
         $via = $from;
271
-        if($version != '' && $version != 'update'){
271
+        if ($version != '' && $version != 'update') {
272 272
           $via .= '-'.$version;
273 273
         }
274 274
 
Please login to merge, or discard this patch.
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -12,91 +12,91 @@  discard block
 block discarded – undo
12 12
 class EpormasCityController extends Controller
13 13
 {
14 14
 
15
-  /**
16
-   * Display a listing of the resource.
17
-   *
18
-   * @return Response
19
-   */
20
-  public function index()
21
-  {
22
-      try {
23
-          $error = false;
24
-          $statusCode = 200;
25
-          $title = 'Success';
26
-          $type = 'success';
27
-          $message = 'Success';
28
-          $result = EpormasCity::all();
29
-      } catch (Exception $e) {
30
-          $error = true;
31
-          $statusCode = 404;
32
-          $title = 'Error';
33
-          $type = 'error';
34
-          $message = 'Error';
35
-          $result = 'Not Found';
36
-      } finally {
37
-          return Response::json(array(
15
+    /**
16
+     * Display a listing of the resource.
17
+     *
18
+     * @return Response
19
+     */
20
+    public function index()
21
+    {
22
+        try {
23
+            $error = false;
24
+            $statusCode = 200;
25
+            $title = 'Success';
26
+            $type = 'success';
27
+            $message = 'Success';
28
+            $result = EpormasCity::all();
29
+        } catch (Exception $e) {
30
+            $error = true;
31
+            $statusCode = 404;
32
+            $title = 'Error';
33
+            $type = 'error';
34
+            $message = 'Error';
35
+            $result = 'Not Found';
36
+        } finally {
37
+            return Response::json(array(
38 38
             'error' => $error,
39 39
             'status' => $statusCode,
40 40
             'title' => $title,
41 41
             'type' => $type,
42 42
             'message' => $message,
43 43
             'result' => $result
44
-          ));
45
-      }
46
-  }
44
+            ));
45
+        }
46
+    }
47 47
 
48
-  /**
49
-   * Show the form for creating a new resource.
50
-   *
51
-   * @return Response
52
-   */
53
-  public function create()
54
-  {
48
+    /**
49
+     * Show the form for creating a new resource.
50
+     *
51
+     * @return Response
52
+     */
53
+    public function create()
54
+    {
55 55
 
56
-  }
56
+    }
57 57
 
58
-  /**
59
-   * Store a newly created resource in storage.
60
-   *
61
-   * @return Response
62
-   */
63
-  public function store(Request $request, $version='')
64
-  {
58
+    /**
59
+     * Store a newly created resource in storage.
60
+     *
61
+     * @return Response
62
+     */
63
+    public function store(Request $request, $version='')
64
+    {
65 65
         $path = \Request::path();
66 66
         $explode = explode('/', $path);
67 67
 
68 68
         $from = 'form';
69 69
         if(in_array('api',$explode)){
70
-          $from = 'api';
70
+            $from = 'api';
71 71
         }
72 72
 
73 73
         $via = $from;
74 74
         if($version != '' && $version != 'store'){
75
-          $via .= '-'.$version;
75
+            $via .= '-'.$version;
76 76
         }
77 77
 
78
-      	$rules = [
78
+            $rules = [
79 79
             'name' => 'required'
80 80
         ];
81 81
 
82 82
         $validator = Validator::make($request->all(), $rules);
83 83
         if ($validator->fails()) {
84
-          return Response::json(array(
85
-              'title' => 'Error',
86
-              'type'  => 'error',
87
-              'message' => $validator->errors()->all()
88
-          ));
84
+            return Response::json(array(
85
+                'title' => 'Error',
86
+                'type'  => 'error',
87
+                'message' => $validator->errors()->all()
88
+            ));
89 89
         }
90 90
 
91 91
         $data = EpormasCity::whereNull('deleted_at')
92 92
                         ->where('name', $request->name)
93 93
                         ->count();
94 94
         if($data > 0){
95
-          return Response::json(array(
96
-              'title' => 'Error',
97
-              'type'  => 'error',
98
-              'message' => 'Data has already been taken.'
99
-          ));
95
+            return Response::json(array(
96
+                'title' => 'Error',
97
+                'type'  => 'error',
98
+                'message' => 'Data has already been taken.'
99
+            ));
100 100
         }
101 101
 
102 102
         $error = false;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
             'name' => $request->name
109 109
         ]);
110 110
         return Response::json(array(
111
-          'error' => $error,
112
-          'status' => $statusCode,
113
-          'title' => $title,
114
-          'type' => $type,
115
-          'message' => $message,
116
-          'result' => $result
111
+            'error' => $error,
112
+            'status' => $statusCode,
113
+            'title' => $title,
114
+            'type' => $type,
115
+            'message' => $message,
116
+            'result' => $result
117 117
         ));
118
-  }
118
+    }
119 119
 
120
-  /**
121
-   * Display the specified resource.
122
-   *
123
-   * @param  int  $id
124
-   * @return Response
125
-   */
126
-  public function show($version='', $id)
127
-  {
120
+    /**
121
+     * Display the specified resource.
122
+     *
123
+     * @param  int  $id
124
+     * @return Response
125
+     */
126
+    public function show($version='', $id)
127
+    {
128 128
         try {
129 129
             $error = false;
130 130
             $statusCode = 200;
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
             $result = 'Not Found';
142 142
         } finally {
143 143
             return Response::json(array(
144
-              'error' => $error,
145
-              'status' => $statusCode,
146
-              'title' => $title,
147
-              'type' => $type,
148
-              'message' => $message,
149
-              'result' => $result
144
+                'error' => $error,
145
+                'status' => $statusCode,
146
+                'title' => $title,
147
+                'type' => $type,
148
+                'message' => $message,
149
+                'result' => $result
150 150
             ));
151 151
         }
152
-  }
152
+    }
153 153
 
154
-  /**
155
-   * Show the form for editing the specified resource.
156
-   *
157
-   * @param  int  $id
158
-   * @return Response
159
-   */
160
-  public function edit($id)
161
-  {
154
+    /**
155
+     * Show the form for editing the specified resource.
156
+     *
157
+     * @param  int  $id
158
+     * @return Response
159
+     */
160
+    public function edit($id)
161
+    {
162 162
         try {
163 163
             $error = false;
164 164
             $statusCode = 200;
@@ -175,24 +175,24 @@  discard block
 block discarded – undo
175 175
             $result = 'Not Found';
176 176
         } finally {
177 177
             return Response::json(array(
178
-              'error' => $error,
179
-              'status' => $statusCode,
180
-              'title' => $title,
181
-              'type' => $type,
182
-              'message' => $message,
183
-              'result' => $result
178
+                'error' => $error,
179
+                'status' => $statusCode,
180
+                'title' => $title,
181
+                'type' => $type,
182
+                'message' => $message,
183
+                'result' => $result
184 184
             ));
185 185
         }
186
-  }
186
+    }
187 187
 
188
-  /**
189
-   * Update the specified resource in storage.
190
-   *
191
-   * @param  int  $id
192
-   * @return Response
193
-   */
194
-  public function update(Request $request, $version='', $id)
195
-  {
188
+    /**
189
+     * Update the specified resource in storage.
190
+     *
191
+     * @param  int  $id
192
+     * @return Response
193
+     */
194
+    public function update(Request $request, $version='', $id)
195
+    {
196 196
         $result = EpormasCity::find($id);
197 197
 
198 198
         $rules = [
@@ -201,24 +201,24 @@  discard block
 block discarded – undo
201 201
 
202 202
         $validator = Validator::make($request->all(), $rules);
203 203
         if ($validator->fails()) {
204
-          return Response::json(array(
205
-              'title' => 'Error',
206
-              'type'  => 'error',
207
-              'message' => $validator->errors()->all()
208
-          ));
204
+            return Response::json(array(
205
+                'title' => 'Error',
206
+                'type'  => 'error',
207
+                'message' => $validator->errors()->all()
208
+            ));
209 209
         }
210 210
 
211 211
         if($request->name != $result->name){
212
-          $data = EpormasCity::whereNull('deleted_at')
213
-                          ->where('name', $request->name)
214
-                          ->count();
215
-          if($data > 0){
212
+            $data = EpormasCity::whereNull('deleted_at')
213
+                            ->where('name', $request->name)
214
+                            ->count();
215
+            if($data > 0){
216 216
             return Response::json(array(
217 217
                 'title' => 'Error',
218 218
                 'type'  => 'error',
219 219
                 'message' => 'Data has already been taken.'
220 220
             ));
221
-          }
221
+            }
222 222
         }
223 223
 
224 224
         $path = \Request::path();
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
 
227 227
         $from = 'form';
228 228
         if(in_array('api',$explode)){
229
-          $from = 'api';
229
+            $from = 'api';
230 230
         }
231 231
 
232 232
         $via = $from;
233 233
         if($version != '' && $version != 'update'){
234
-          $via .= '-'.$version;
234
+            $via .= '-'.$version;
235 235
         }
236 236
 
237 237
         $error = false;
@@ -243,37 +243,37 @@  discard block
 block discarded – undo
243 243
             'name' => $request->name
244 244
         ]);
245 245
         return Response::json(array(
246
-          'error' => $error,
247
-          'status' => $statusCode,
248
-          'title' => $title,
249
-          'type' => $type,
250
-          'message' => $message,
251
-          'result' => $result
246
+            'error' => $error,
247
+            'status' => $statusCode,
248
+            'title' => $title,
249
+            'type' => $type,
250
+            'message' => $message,
251
+            'result' => $result
252 252
         ));
253
-  }
253
+    }
254 254
 
255
-  /**
256
-   * Remove the specified resource from storage.
257
-   *
258
-   * @param  int  $id
259
-   * @return Response
260
-   */
261
-  public function destroy($id)
262
-  {
263
-      EpormasCity::find($id)->delete();
264
-      $error = false;
265
-      $statusCode = 200;
266
-      $title = 'Success';
267
-      $type = 'success';
268
-      $message = 'Data deleted successfully';
269
-      return Response::json(array(
255
+    /**
256
+     * Remove the specified resource from storage.
257
+     *
258
+     * @param  int  $id
259
+     * @return Response
260
+     */
261
+    public function destroy($id)
262
+    {
263
+        EpormasCity::find($id)->delete();
264
+        $error = false;
265
+        $statusCode = 200;
266
+        $title = 'Success';
267
+        $type = 'success';
268
+        $message = 'Data deleted successfully';
269
+        return Response::json(array(
270 270
         'error' => $error,
271 271
         'status' => $statusCode,
272 272
         'title' => $title,
273 273
         'type' => $type,
274 274
         'message' => $message
275
-      ));
276
-  }
275
+        ));
276
+    }
277 277
 
278 278
 }
279 279
 
Please login to merge, or discard this patch.
src/Http/Controllers/EpormasCounterController.php 3 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -91,18 +91,18 @@  discard block
 block discarded – undo
91 91
    *
92 92
    * @return Response
93 93
    */
94
-  public function store(Request $request, $version='')
94
+  public function store(Request $request, $version = '')
95 95
   {
96 96
         $path = \Request::path();
97 97
         $explode = explode('/', $path);
98 98
 
99 99
         $from = 'form';
100
-        if(in_array('api',$explode)){
100
+        if (in_array('api', $explode)) {
101 101
           $from = 'api';
102 102
         }
103 103
 
104 104
         $via = $from;
105
-        if($version != '' && $version != 'store'){
105
+        if ($version != '' && $version != 'store') {
106 106
           $via .= '-'.$version;
107 107
         }
108 108
 
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
           ));
123 123
         }
124 124
 
125
-        if($request->tanggal){
126
-          $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
125
+        if ($request->tanggal) {
126
+          $formats = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
127 127
         }else {
128 128
           $formats = '';
129 129
         }
130 130
         $format = $formats;
131 131
         $resultcek = EpormasCounter::whereNull('deleted_at')
132
-                             ->where('tanggal','like','%'.$format.'%')
133
-                             ->where('category_id',$request->category_id)
134
-                             ->where('city_id',$request->city_id)
135
-                             ->groupBy('tahun','bulan','category_id','city_id')
132
+                             ->where('tanggal', 'like', '%'.$format.'%')
133
+                             ->where('category_id', $request->category_id)
134
+                             ->where('city_id', $request->city_id)
135
+                             ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
136 136
                              ->orderBy('bulan')
137 137
                              ->count();
138
-        if($resultcek > 0){
138
+        if ($resultcek > 0) {
139 139
           return Response::json(array(
140 140
               'title' => 'Error',
141 141
               'type'  => 'error',
@@ -143,16 +143,16 @@  discard block
 block discarded – undo
143 143
           ));
144 144
         }
145 145
 
146
-        $date = explode("-",$format);
146
+        $date = explode("-", $format);
147 147
         $data = EpormasCounter::whereNull('deleted_at')
148 148
                        ->where('tahun', $date[0])
149 149
                        ->where('bulan', $date[1])
150
-                       ->where('category_id',$request->category_id)
151
-                       ->where('city_id',$request->city_id)
152
-                       ->groupBy('tahun','bulan','category_id','city_id')
150
+                       ->where('category_id', $request->category_id)
151
+                       ->where('city_id', $request->city_id)
152
+                       ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
153 153
                        ->orderBy('bulan')
154 154
                        ->count();
155
-        if($data > 0){
155
+        if ($data > 0) {
156 156
           return Response::json(array(
157 157
               'title' => 'Error',
158 158
               'type'  => 'error',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
    * @param  int  $id
192 192
    * @return Response
193 193
    */
194
-  public function show($version='', $id)
194
+  public function show($version = '', $id)
195 195
   {
196 196
         try {
197 197
             $error = false;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                             ->with('getCity')
243 243
                             ->with('getCategory')
244 244
                             ->find($id);
245
-            if($result->tanggal){
245
+            if ($result->tanggal) {
246 246
               $formats = date('Y-m-d', strtotime($result->tanggal));
247 247
             }else {
248 248
               $formats = 'Not Found';
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
    * @param  int  $id
280 280
    * @return Response
281 281
    */
282
-  public function update(Request $request, $version='', $id)
282
+  public function update(Request $request, $version = '', $id)
283 283
   {
284 284
         $result = EpormasCounter::whereNull('deleted_at')
285 285
                         ->with('getCity')
@@ -302,21 +302,21 @@  discard block
 block discarded – undo
302 302
           ));
303 303
         }
304 304
 
305
-        if($request->tanggal){
306
-          $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
305
+        if ($request->tanggal) {
306
+          $formats = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
307 307
         }else {
308 308
           $formats = '';
309 309
         }
310 310
         $format = $formats;
311
-        if($result->city_id != $request->city_id || $result->category_id != $request->category_id){
311
+        if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) {
312 312
             $resultcek = EpormasCounter::whereNull('deleted_at')
313
-                                 ->where('tanggal','like','%'.$format.'%')
314
-            		                 ->where('category_id',$request->category_id)
315
-            		                 ->where('city_id',$request->city_id)
316
-                                 ->groupBy('tahun','bulan','category_id','city_id')
313
+                                 ->where('tanggal', 'like', '%'.$format.'%')
314
+            		                 ->where('category_id', $request->category_id)
315
+            		                 ->where('city_id', $request->city_id)
316
+                                 ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
317 317
                                  ->orderBy('bulan')
318 318
                                  ->count();
319
-            if($resultcek > 0){
319
+            if ($resultcek > 0) {
320 320
               return Response::json(array(
321 321
                   'title' => 'Error',
322 322
                   'type'  => 'error',
@@ -325,17 +325,17 @@  discard block
 block discarded – undo
325 325
             }
326 326
         }
327 327
 
328
-        $date = explode("-",$format);
328
+        $date = explode("-", $format);
329 329
         $dates = date('Y-m-d', strtotime($result->tanggal));
330
-        if($dates != $format){
330
+        if ($dates != $format) {
331 331
             $resultcek = EpormasCounter::whereNull('deleted_at')
332
-            		                 ->where('category_id',$request->category_id)
333
-            		                 ->where('city_id',$request->city_id)
334
-                                 ->where('tanggal','like','%'.$format.'%')
335
-                                 ->groupBy('tahun','bulan','category_id','city_id')
332
+            		                 ->where('category_id', $request->category_id)
333
+            		                 ->where('city_id', $request->city_id)
334
+                                 ->where('tanggal', 'like', '%'.$format.'%')
335
+                                 ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
336 336
                                  ->orderBy('bulan')
337 337
                                  ->count();
338
-            if($resultcek > 0){
338
+            if ($resultcek > 0) {
339 339
               return Response::json(array(
340 340
                   'title' => 'Error',
341 341
                   'type'  => 'error',
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
             $data = EpormasCounter::whereNull('deleted_at')
347 347
                            ->where('tahun', $date[0])
348 348
                            ->where('bulan', $date[1])
349
-            		           ->where('category_id',$request->category_id)
350
-            		           ->where('city_id',$request->city_id)
351
-                           ->groupBy('tahun','bulan','category_id','city_id')
349
+            		           ->where('category_id', $request->category_id)
350
+            		           ->where('city_id', $request->city_id)
351
+                           ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
352 352
                            ->orderBy('bulan')
353 353
                            ->count();
354
-            if($data > 0){
354
+            if ($data > 0) {
355 355
               return Response::json(array(
356 356
                   'title' => 'Error',
357 357
                   'type'  => 'error',
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 
366 366
         $from = $result->via;
367 367
         $user_id = $result->user_id;
368
-        if(in_array('api',$explode)){
368
+        if (in_array('api', $explode)) {
369 369
           $from = 'api';
370 370
           $user_id = $request->user_id;
371 371
         }
372 372
 
373 373
         $via = $from;
374
-        if($version != '' && $version != 'update'){
374
+        if ($version != '' && $version != 'update') {
375 375
           $via .= '-'.$version;
376 376
         }
377 377
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
         if($request->tanggal){
126 126
           $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
127
-        }else {
127
+        } else {
128 128
           $formats = '';
129 129
         }
130 130
         $format = $formats;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                             ->find($id);
245 245
             if($result->tanggal){
246 246
               $formats = date('Y-m-d', strtotime($result->tanggal));
247
-            }else {
247
+            } else {
248 248
               $formats = 'Not Found';
249 249
             }
250 250
             $format = $formats;
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
         if($request->tanggal){
306 306
           $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
307
-        }else {
307
+        } else {
308 308
           $formats = '';
309 309
         }
310 310
         $format = $formats;
Please login to merge, or discard this patch.
Indentation   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -14,67 +14,67 @@  discard block
 block discarded – undo
14 14
 class EpormasCounterController extends Controller
15 15
 {
16 16
 
17
-  /**
18
-   * Display a listing of the resource.
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(
17
+    /**
18
+     * Display a listing of the resource.
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 43
             'error' => $error,
44 44
             'status' => $statusCode,
45 45
             'title' => $title,
46 46
             'type' => $type,
47 47
             'message' => $message,
48 48
             'result' => $result
49
-          ));
50
-      }
51
-  }
49
+            ));
50
+        }
51
+    }
52 52
 
53
-  /**
54
-   * Show the form for creating a new resource.
55
-   *
56
-   * @return Response
57
-   */
58
-  public function create()
59
-  {
60
-      try {
61
-          $category = EpormasCategory::all();
62
-          $city = EpormasCity::all();
63
-          $error = false;
64
-          $statusCode = 200;
65
-          $title = 'Success';
66
-          $type = 'success';
67
-          $message = 'Success';
68
-      } catch (Exception $e) {
69
-          $category = 'Not Found';
70
-          $city = 'Not Found';
71
-          $error = true;
72
-          $statusCode = 404;
73
-          $title = 'Error';
74
-          $type = 'error';
75
-          $message = 'Error';
76
-      } finally {
77
-          return Response::json(array(
53
+    /**
54
+     * Show the form for creating a new resource.
55
+     *
56
+     * @return Response
57
+     */
58
+    public function create()
59
+    {
60
+        try {
61
+            $category = EpormasCategory::all();
62
+            $city = EpormasCity::all();
63
+            $error = false;
64
+            $statusCode = 200;
65
+            $title = 'Success';
66
+            $type = 'success';
67
+            $message = 'Success';
68
+        } catch (Exception $e) {
69
+            $category = 'Not Found';
70
+            $city = 'Not Found';
71
+            $error = true;
72
+            $statusCode = 404;
73
+            $title = 'Error';
74
+            $type = 'error';
75
+            $message = 'Error';
76
+        } finally {
77
+            return Response::json(array(
78 78
             'error' => $error,
79 79
             'status' => $statusCode,
80 80
             'title' => $title,
@@ -82,31 +82,31 @@  discard block
 block discarded – undo
82 82
             'category' => $category,
83 83
             'city' => $city,
84 84
             'message' => $message
85
-          ));
86
-      }
87
-  }
85
+            ));
86
+        }
87
+    }
88 88
 
89
-  /**
90
-   * Store a newly created resource in storage.
91
-   *
92
-   * @return Response
93
-   */
94
-  public function store(Request $request, $version='')
95
-  {
89
+    /**
90
+     * Store a newly created resource in storage.
91
+     *
92
+     * @return Response
93
+     */
94
+    public function store(Request $request, $version='')
95
+    {
96 96
         $path = \Request::path();
97 97
         $explode = explode('/', $path);
98 98
 
99 99
         $from = 'form';
100 100
         if(in_array('api',$explode)){
101
-          $from = 'api';
101
+            $from = 'api';
102 102
         }
103 103
 
104 104
         $via = $from;
105 105
         if($version != '' && $version != 'store'){
106
-          $via .= '-'.$version;
106
+            $via .= '-'.$version;
107 107
         }
108 108
 
109
-      	$rules = [
109
+            $rules = [
110 110
             'count' => 'required|numeric',
111 111
             'city_id' => 'required|numeric',
112 112
             'category_id' => 'required|numeric',
@@ -115,49 +115,49 @@  discard block
 block discarded – undo
115 115
 
116 116
         $validator = Validator::make($request->all(), $rules);
117 117
         if ($validator->fails()) {
118
-          return Response::json(array(
119
-              'title' => 'Error',
120
-              'type'  => 'error',
121
-              'message' => $validator->errors()->all()
122
-          ));
118
+            return Response::json(array(
119
+                'title' => 'Error',
120
+                'type'  => 'error',
121
+                'message' => $validator->errors()->all()
122
+            ));
123 123
         }
124 124
 
125 125
         if($request->tanggal){
126
-          $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
126
+            $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
127 127
         }else {
128
-          $formats = '';
128
+            $formats = '';
129 129
         }
130 130
         $format = $formats;
131 131
         $resultcek = EpormasCounter::whereNull('deleted_at')
132
-                             ->where('tanggal','like','%'.$format.'%')
133
-                             ->where('category_id',$request->category_id)
134
-                             ->where('city_id',$request->city_id)
135
-                             ->groupBy('tahun','bulan','category_id','city_id')
136
-                             ->orderBy('bulan')
137
-                             ->count();
132
+                                ->where('tanggal','like','%'.$format.'%')
133
+                                ->where('category_id',$request->category_id)
134
+                                ->where('city_id',$request->city_id)
135
+                                ->groupBy('tahun','bulan','category_id','city_id')
136
+                                ->orderBy('bulan')
137
+                                ->count();
138 138
         if($resultcek > 0){
139
-          return Response::json(array(
140
-              'title' => 'Error',
141
-              'type'  => 'error',
142
-              'message' => 'Data has already been taken.'
143
-          ));
139
+            return Response::json(array(
140
+                'title' => 'Error',
141
+                'type'  => 'error',
142
+                'message' => 'Data has already been taken.'
143
+            ));
144 144
         }
145 145
 
146 146
         $date = explode("-",$format);
147 147
         $data = EpormasCounter::whereNull('deleted_at')
148
-                       ->where('tahun', $date[0])
149
-                       ->where('bulan', $date[1])
150
-                       ->where('category_id',$request->category_id)
151
-                       ->where('city_id',$request->city_id)
152
-                       ->groupBy('tahun','bulan','category_id','city_id')
153
-                       ->orderBy('bulan')
154
-                       ->count();
148
+                        ->where('tahun', $date[0])
149
+                        ->where('bulan', $date[1])
150
+                        ->where('category_id',$request->category_id)
151
+                        ->where('city_id',$request->city_id)
152
+                        ->groupBy('tahun','bulan','category_id','city_id')
153
+                        ->orderBy('bulan')
154
+                        ->count();
155 155
         if($data > 0){
156
-          return Response::json(array(
157
-              'title' => 'Error',
158
-              'type'  => 'error',
159
-              'message' => 'Data has already been taken.'
160
-          ));
156
+            return Response::json(array(
157
+                'title' => 'Error',
158
+                'type'  => 'error',
159
+                'message' => 'Data has already been taken.'
160
+            ));
161 161
         }
162 162
 
163 163
         $error = false;
@@ -176,23 +176,23 @@  discard block
 block discarded – undo
176 176
             'via' => $via
177 177
         ]);
178 178
         return Response::json(array(
179
-          'error' => $error,
180
-          'status' => $statusCode,
181
-          'title' => $title,
182
-          'type' => $type,
183
-          'message' => $message,
184
-          'result' => $result
179
+            'error' => $error,
180
+            'status' => $statusCode,
181
+            'title' => $title,
182
+            'type' => $type,
183
+            'message' => $message,
184
+            'result' => $result
185 185
         ));
186
-  }
186
+    }
187 187
 
188
-  /**
189
-   * Display the specified resource.
190
-   *
191
-   * @param  int  $id
192
-   * @return Response
193
-   */
194
-  public function show($version='', $id)
195
-  {
188
+    /**
189
+     * Display the specified resource.
190
+     *
191
+     * @param  int  $id
192
+     * @return Response
193
+     */
194
+    public function show($version='', $id)
195
+    {
196 196
         try {
197 197
             $error = false;
198 198
             $statusCode = 200;
@@ -212,24 +212,24 @@  discard block
 block discarded – undo
212 212
             $result = 'Not Found';
213 213
         } finally {
214 214
             return Response::json(array(
215
-              'error' => $error,
216
-              'status' => $statusCode,
217
-              'title' => $title,
218
-              'type' => $type,
219
-              'message' => $message,
220
-              'result' => $result
215
+                'error' => $error,
216
+                'status' => $statusCode,
217
+                'title' => $title,
218
+                'type' => $type,
219
+                'message' => $message,
220
+                'result' => $result
221 221
             ));
222 222
         }
223
-  }
223
+    }
224 224
 
225
-  /**
226
-   * Show the form for editing the specified resource.
227
-   *
228
-   * @param  int  $id
229
-   * @return Response
230
-   */
231
-  public function edit($id)
232
-  {
225
+    /**
226
+     * Show the form for editing the specified resource.
227
+     *
228
+     * @param  int  $id
229
+     * @return Response
230
+     */
231
+    public function edit($id)
232
+    {
233 233
         try {
234 234
             $category = EpormasCategory::all();
235 235
             $city = EpormasCity::all();
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
                             ->with('getCategory')
244 244
                             ->find($id);
245 245
             if($result->tanggal){
246
-              $formats = date('Y-m-d', strtotime($result->tanggal));
246
+                $formats = date('Y-m-d', strtotime($result->tanggal));
247 247
             }else {
248
-              $formats = 'Not Found';
248
+                $formats = 'Not Found';
249 249
             }
250 250
             $format = $formats;
251 251
         } catch (Exception $e) {
@@ -260,27 +260,27 @@  discard block
 block discarded – undo
260 260
             $format = 'Not Found';
261 261
         } finally {
262 262
             return Response::json(array(
263
-              'error' => $error,
264
-              'status' => $statusCode,
265
-              'title' => $title,
266
-              'type' => $type,
267
-              'message' => $message,
268
-              'tanggal' => $format,
269
-              'city' => $city,
270
-              'category' => $category,
271
-              'result' => $result
263
+                'error' => $error,
264
+                'status' => $statusCode,
265
+                'title' => $title,
266
+                'type' => $type,
267
+                'message' => $message,
268
+                'tanggal' => $format,
269
+                'city' => $city,
270
+                'category' => $category,
271
+                'result' => $result
272 272
             ));
273 273
         }
274
-  }
274
+    }
275 275
 
276
-  /**
277
-   * Update the specified resource in storage.
278
-   *
279
-   * @param  int  $id
280
-   * @return Response
281
-   */
282
-  public function update(Request $request, $version='', $id)
283
-  {
276
+    /**
277
+     * Update the specified resource in storage.
278
+     *
279
+     * @param  int  $id
280
+     * @return Response
281
+     */
282
+    public function update(Request $request, $version='', $id)
283
+    {
284 284
         $result = EpormasCounter::whereNull('deleted_at')
285 285
                         ->with('getCity')
286 286
                         ->with('getCategory')
@@ -295,33 +295,33 @@  discard block
 block discarded – undo
295 295
 
296 296
         $validator = Validator::make($request->all(), $rules);
297 297
         if ($validator->fails()) {
298
-          return Response::json(array(
299
-              'title' => 'Error',
300
-              'type'  => 'error',
301
-              'message' => $validator->errors()->all()
302
-          ));
298
+            return Response::json(array(
299
+                'title' => 'Error',
300
+                'type'  => 'error',
301
+                'message' => $validator->errors()->all()
302
+            ));
303 303
         }
304 304
 
305 305
         if($request->tanggal){
306
-          $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
306
+            $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
307 307
         }else {
308
-          $formats = '';
308
+            $formats = '';
309 309
         }
310 310
         $format = $formats;
311 311
         if($result->city_id != $request->city_id || $result->category_id != $request->category_id){
312 312
             $resultcek = EpormasCounter::whereNull('deleted_at')
313
-                                 ->where('tanggal','like','%'.$format.'%')
314
-            		                 ->where('category_id',$request->category_id)
315
-            		                 ->where('city_id',$request->city_id)
316
-                                 ->groupBy('tahun','bulan','category_id','city_id')
317
-                                 ->orderBy('bulan')
318
-                                 ->count();
313
+                                    ->where('tanggal','like','%'.$format.'%')
314
+                                        ->where('category_id',$request->category_id)
315
+                                        ->where('city_id',$request->city_id)
316
+                                    ->groupBy('tahun','bulan','category_id','city_id')
317
+                                    ->orderBy('bulan')
318
+                                    ->count();
319 319
             if($resultcek > 0){
320
-              return Response::json(array(
321
-                  'title' => 'Error',
322
-                  'type'  => 'error',
323
-                  'message' => 'Data has already been taken.'
324
-              ));
320
+                return Response::json(array(
321
+                    'title' => 'Error',
322
+                    'type'  => 'error',
323
+                    'message' => 'Data has already been taken.'
324
+                ));
325 325
             }
326 326
         }
327 327
 
@@ -329,34 +329,34 @@  discard block
 block discarded – undo
329 329
         $dates = date('Y-m-d', strtotime($result->tanggal));
330 330
         if($dates != $format){
331 331
             $resultcek = EpormasCounter::whereNull('deleted_at')
332
-            		                 ->where('category_id',$request->category_id)
333
-            		                 ->where('city_id',$request->city_id)
334
-                                 ->where('tanggal','like','%'.$format.'%')
335
-                                 ->groupBy('tahun','bulan','category_id','city_id')
336
-                                 ->orderBy('bulan')
337
-                                 ->count();
332
+                                        ->where('category_id',$request->category_id)
333
+                                        ->where('city_id',$request->city_id)
334
+                                    ->where('tanggal','like','%'.$format.'%')
335
+                                    ->groupBy('tahun','bulan','category_id','city_id')
336
+                                    ->orderBy('bulan')
337
+                                    ->count();
338 338
             if($resultcek > 0){
339
-              return Response::json(array(
340
-                  'title' => 'Error',
341
-                  'type'  => 'error',
342
-                  'message' => 'Data has already been taken.'
343
-              ));
339
+                return Response::json(array(
340
+                    'title' => 'Error',
341
+                    'type'  => 'error',
342
+                    'message' => 'Data has already been taken.'
343
+                ));
344 344
             }
345 345
 
346 346
             $data = EpormasCounter::whereNull('deleted_at')
347
-                           ->where('tahun', $date[0])
348
-                           ->where('bulan', $date[1])
349
-            		           ->where('category_id',$request->category_id)
350
-            		           ->where('city_id',$request->city_id)
351
-                           ->groupBy('tahun','bulan','category_id','city_id')
352
-                           ->orderBy('bulan')
353
-                           ->count();
347
+                            ->where('tahun', $date[0])
348
+                            ->where('bulan', $date[1])
349
+                                ->where('category_id',$request->category_id)
350
+                                ->where('city_id',$request->city_id)
351
+                            ->groupBy('tahun','bulan','category_id','city_id')
352
+                            ->orderBy('bulan')
353
+                            ->count();
354 354
             if($data > 0){
355
-              return Response::json(array(
356
-                  'title' => 'Error',
357
-                  'type'  => 'error',
358
-                  'message' => 'Data has already been taken.'
359
-              ));
355
+                return Response::json(array(
356
+                    'title' => 'Error',
357
+                    'type'  => 'error',
358
+                    'message' => 'Data has already been taken.'
359
+                ));
360 360
             }
361 361
         }
362 362
 
@@ -366,13 +366,13 @@  discard block
 block discarded – undo
366 366
         $from = $result->via;
367 367
         $user_id = $result->user_id;
368 368
         if(in_array('api',$explode)){
369
-          $from = 'api';
370
-          $user_id = $request->user_id;
369
+            $from = 'api';
370
+            $user_id = $request->user_id;
371 371
         }
372 372
 
373 373
         $via = $from;
374 374
         if($version != '' && $version != 'update'){
375
-          $via .= '-'.$version;
375
+            $via .= '-'.$version;
376 376
         }
377 377
 
378 378
         $error = false;
@@ -391,36 +391,36 @@  discard block
 block discarded – undo
391 391
             'via' => $via
392 392
         ]);
393 393
         return Response::json(array(
394
-          'error' => $error,
395
-          'status' => $statusCode,
396
-          'title' => $title,
397
-          'type' => $type,
398
-          'message' => $message,
399
-          'result' => $result
394
+            'error' => $error,
395
+            'status' => $statusCode,
396
+            'title' => $title,
397
+            'type' => $type,
398
+            'message' => $message,
399
+            'result' => $result
400 400
         ));
401
-  }
401
+    }
402 402
 
403
-  /**
404
-   * Remove the specified resource from storage.
405
-   *
406
-   * @param  int  $id
407
-   * @return Response
408
-   */
409
-  public function destroy($id)
410
-  {
411
-      EpormasCounter::find($id)->delete();
412
-      $error = false;
413
-      $statusCode = 200;
414
-      $title = 'Success';
415
-      $type = 'success';
416
-      $message = 'Data deleted successfully';
417
-      return Response::json(array(
403
+    /**
404
+     * Remove the specified resource from storage.
405
+     *
406
+     * @param  int  $id
407
+     * @return Response
408
+     */
409
+    public function destroy($id)
410
+    {
411
+        EpormasCounter::find($id)->delete();
412
+        $error = false;
413
+        $statusCode = 200;
414
+        $title = 'Success';
415
+        $type = 'success';
416
+        $message = 'Data deleted successfully';
417
+        return Response::json(array(
418 418
         'error' => $error,
419 419
         'status' => $statusCode,
420 420
         'title' => $title,
421 421
         'type' => $type,
422 422
         'message' => $message
423
-      ));
424
-  }
423
+        ));
424
+    }
425 425
 
426 426
 }
Please login to merge, or discard this patch.