@@ -91,18 +91,18 @@ discard block |
||
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,15 +122,15 @@ discard block |
||
122 | 122 | ]); |
123 | 123 | } |
124 | 124 | |
125 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal))); |
|
125 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal))); |
|
126 | 126 | $resultcek = EpormasCounter::whereNull('deleted_at') |
127 | - ->where('tanggal','like','%'.$format.'%') |
|
128 | - ->where('category_id',$request->category_id) |
|
129 | - ->where('city_id',$request->city_id) |
|
130 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
127 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
128 | + ->where('category_id', $request->category_id) |
|
129 | + ->where('city_id', $request->city_id) |
|
130 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
131 | 131 | ->orderBy('bulan') |
132 | 132 | ->count(); |
133 | - if($resultcek > 0){ |
|
133 | + if ($resultcek > 0) { |
|
134 | 134 | return response()->json([ |
135 | 135 | 'title' => 'Error', |
136 | 136 | 'type' => 'error', |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | ]); |
139 | 139 | } |
140 | 140 | |
141 | - $date = explode("-",$format); |
|
141 | + $date = explode("-", $format); |
|
142 | 142 | $data = EpormasCounter::whereNull('deleted_at') |
143 | 143 | ->where('tahun', $date[0]) |
144 | 144 | ->where('bulan', $date[1]) |
145 | - ->where('category_id',$request->category_id) |
|
146 | - ->where('city_id',$request->city_id) |
|
147 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
145 | + ->where('category_id', $request->category_id) |
|
146 | + ->where('city_id', $request->city_id) |
|
147 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
148 | 148 | ->orderBy('bulan') |
149 | 149 | ->count(); |
150 | - if($data > 0){ |
|
150 | + if ($data > 0) { |
|
151 | 151 | return response()->json([ |
152 | 152 | 'title' => 'Error', |
153 | 153 | 'type' => 'error', |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param int $id |
197 | 197 | * @return Response |
198 | 198 | */ |
199 | - public function show($version='', $id) |
|
199 | + public function show($version = '', $id) |
|
200 | 200 | { |
201 | 201 | try { |
202 | 202 | $error = false; |
@@ -279,7 +279,7 @@ discard block |
||
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,16 +302,16 @@ discard block |
||
302 | 302 | ]); |
303 | 303 | } |
304 | 304 | |
305 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal))); |
|
306 | - if($result->city_id != $request->city_id || $result->category_id != $request->category_id){ |
|
305 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal))); |
|
306 | + if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) { |
|
307 | 307 | $resultcek = EpormasCounter::whereNull('deleted_at') |
308 | - ->where('tanggal','like','%'.$format.'%') |
|
309 | - ->where('category_id',$request->category_id) |
|
310 | - ->where('city_id',$request->city_id) |
|
311 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
308 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
309 | + ->where('category_id', $request->category_id) |
|
310 | + ->where('city_id', $request->city_id) |
|
311 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
312 | 312 | ->orderBy('bulan') |
313 | 313 | ->count(); |
314 | - if($resultcek > 0){ |
|
314 | + if ($resultcek > 0) { |
|
315 | 315 | return response()->json([ |
316 | 316 | 'title' => 'Error', |
317 | 317 | 'type' => 'error', |
@@ -320,17 +320,17 @@ discard block |
||
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - $date = explode("-",$format); |
|
323 | + $date = explode("-", $format); |
|
324 | 324 | $dates = date('Y-m-d', strtotime($result->tanggal)); |
325 | - if($dates != $format){ |
|
325 | + if ($dates != $format) { |
|
326 | 326 | $resultcek = EpormasCounter::whereNull('deleted_at') |
327 | - ->where('category_id',$request->category_id) |
|
328 | - ->where('city_id',$request->city_id) |
|
329 | - ->where('tanggal','like','%'.$format.'%') |
|
330 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
327 | + ->where('category_id', $request->category_id) |
|
328 | + ->where('city_id', $request->city_id) |
|
329 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
330 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
331 | 331 | ->orderBy('bulan') |
332 | 332 | ->count(); |
333 | - if($resultcek > 0){ |
|
333 | + if ($resultcek > 0) { |
|
334 | 334 | return response()->json([ |
335 | 335 | 'title' => 'Error', |
336 | 336 | 'type' => 'error', |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | $data = EpormasCounter::whereNull('deleted_at') |
342 | 342 | ->where('tahun', $date[0]) |
343 | 343 | ->where('bulan', $date[1]) |
344 | - ->where('category_id',$request->category_id) |
|
345 | - ->where('city_id',$request->city_id) |
|
346 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
344 | + ->where('category_id', $request->category_id) |
|
345 | + ->where('city_id', $request->city_id) |
|
346 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
347 | 347 | ->orderBy('bulan') |
348 | 348 | ->count(); |
349 | - if($data > 0){ |
|
349 | + if ($data > 0) { |
|
350 | 350 | return response()->json([ |
351 | 351 | 'title' => 'Error', |
352 | 352 | 'type' => 'error', |
@@ -360,13 +360,13 @@ discard block |
||
360 | 360 | |
361 | 361 | $from = $result->via; |
362 | 362 | $user_id = $result->user_id; |
363 | - if(in_array('api',$explode)){ |
|
363 | + if (in_array('api', $explode)) { |
|
364 | 364 | $from = 'api'; |
365 | 365 | $user_id = $request->user_id; |
366 | 366 | } |
367 | 367 | |
368 | 368 | $via = $from; |
369 | - if($version != '' && $version != 'update'){ |
|
369 | + if ($version != '' && $version != 'update') { |
|
370 | 370 | $via .= '-'.$version; |
371 | 371 | } |
372 | 372 |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return Response |
62 | 62 | */ |
63 | - public function store(Request $request, $version='') |
|
63 | + public function store(Request $request, $version = '') |
|
64 | 64 | { |
65 | 65 | $path = \Request::path(); |
66 | 66 | $explode = explode('/', $path); |
67 | 67 | |
68 | 68 | $from = 'form'; |
69 | - if(in_array('api',$explode)){ |
|
69 | + if (in_array('api', $explode)) { |
|
70 | 70 | $from = 'api'; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $via = $from; |
74 | - if($version != '' && $version != 'store'){ |
|
74 | + if ($version != '' && $version != 'store') { |
|
75 | 75 | $via .= '-'.$version; |
76 | 76 | } |
77 | 77 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $data = EpormasCity::whereNull('deleted_at') |
92 | 92 | ->where('name', $request->name) |
93 | 93 | ->count(); |
94 | - if($data > 0){ |
|
94 | + if ($data > 0) { |
|
95 | 95 | return response()->json([ |
96 | 96 | 'title' => 'Error', |
97 | 97 | 'type' => 'error', |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param int $id |
134 | 134 | * @return Response |
135 | 135 | */ |
136 | - public function show($version='', $id) |
|
136 | + public function show($version = '', $id) |
|
137 | 137 | { |
138 | 138 | try { |
139 | 139 | $error = false; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param int $id |
202 | 202 | * @return Response |
203 | 203 | */ |
204 | - public function update(Request $request, $version='', $id) |
|
204 | + public function update(Request $request, $version = '', $id) |
|
205 | 205 | { |
206 | 206 | $result = EpormasCity::find($id); |
207 | 207 | |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | ]); |
219 | 219 | } |
220 | 220 | |
221 | - if($request->name != $result->name){ |
|
221 | + if ($request->name != $result->name) { |
|
222 | 222 | $data = EpormasCity::whereNull('deleted_at') |
223 | 223 | ->where('name', $request->name) |
224 | 224 | ->count(); |
225 | - if($data > 0){ |
|
225 | + if ($data > 0) { |
|
226 | 226 | return response()->json([ |
227 | 227 | 'title' => 'Error', |
228 | 228 | 'type' => 'error', |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | $explode = explode('/', $path); |
236 | 236 | |
237 | 237 | $from = 'form'; |
238 | - if(in_array('api',$explode)){ |
|
238 | + if (in_array('api', $explode)) { |
|
239 | 239 | $from = 'api'; |
240 | 240 | } |
241 | 241 | |
242 | 242 | $via = $from; |
243 | - if($version != '' && $version != 'update'){ |
|
243 | + if ($version != '' && $version != 'update') { |
|
244 | 244 | $via .= '-'.$version; |
245 | 245 | } |
246 | 246 |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return Response |
62 | 62 | */ |
63 | - public function store(Request $request, $version='') |
|
63 | + public function store(Request $request, $version = '') |
|
64 | 64 | { |
65 | 65 | $path = \Request::path(); |
66 | 66 | $explode = explode('/', $path); |
67 | 67 | |
68 | 68 | $from = 'form'; |
69 | - if(in_array('api',$explode)){ |
|
69 | + if (in_array('api', $explode)) { |
|
70 | 70 | $from = 'api'; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $via = $from; |
74 | - if($version != '' && $version != 'store'){ |
|
74 | + if ($version != '' && $version != 'store') { |
|
75 | 75 | $via .= '-'.$version; |
76 | 76 | } |
77 | 77 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $data = EpormasCategory::whereNull('deleted_at') |
92 | 92 | ->where('name', $request->name) |
93 | 93 | ->count(); |
94 | - if($data > 0){ |
|
94 | + if ($data > 0) { |
|
95 | 95 | return response()->json([ |
96 | 96 | 'title' => 'Error', |
97 | 97 | 'type' => 'error', |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param int $id |
134 | 134 | * @return Response |
135 | 135 | */ |
136 | - public function show($version='', $id) |
|
136 | + public function show($version = '', $id) |
|
137 | 137 | { |
138 | 138 | try { |
139 | 139 | $error = false; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param int $id |
202 | 202 | * @return Response |
203 | 203 | */ |
204 | - public function update(Request $request, $version='', $id) |
|
204 | + public function update(Request $request, $version = '', $id) |
|
205 | 205 | { |
206 | 206 | $result = EpormasCategory::find($id); |
207 | 207 | |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | ]); |
219 | 219 | } |
220 | 220 | |
221 | - if($request->name != $result->name){ |
|
221 | + if ($request->name != $result->name) { |
|
222 | 222 | $data = EpormasCategory::whereNull('deleted_at') |
223 | 223 | ->where('name', $request->name) |
224 | 224 | ->count(); |
225 | - if($data > 0){ |
|
225 | + if ($data > 0) { |
|
226 | 226 | return response()->json([ |
227 | 227 | 'title' => 'Error', |
228 | 228 | 'type' => 'error', |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | $explode = explode('/', $path); |
236 | 236 | |
237 | 237 | $from = 'form'; |
238 | - if(in_array('api',$explode)){ |
|
238 | + if (in_array('api', $explode)) { |
|
239 | 239 | $from = 'api'; |
240 | 240 | } |
241 | 241 | |
242 | 242 | $via = $from; |
243 | - if($version != '' && $version != 'update'){ |
|
243 | + if ($version != '' && $version != 'update') { |
|
244 | 244 | $via .= '-'.$version; |
245 | 245 | } |
246 | 246 |