@@ -71,31 +71,31 @@ |
||
71 | 71 | |
72 | 72 | protected function controllerViewCreate() |
73 | 73 | { |
74 | - foreach($this->stubsController['controllers'] as $stub) |
|
74 | + foreach ($this->stubsController['controllers'] as $stub) |
|
75 | 75 | { |
76 | - File::put(base_path('app/Http/Controllers/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/Controllers/'.$stub)); |
|
76 | + File::put(base_path('app/Http/Controllers/').str_replace('stub', 'php', $stub), File::get(__DIR__.'/../../stubs/Controllers/'.$stub)); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | 80 | protected function modelViewCreate() |
81 | 81 | { |
82 | - foreach($this->stubsModel['models'] as $stub) |
|
82 | + foreach ($this->stubsModel['models'] as $stub) |
|
83 | 83 | { |
84 | - File::put(base_path('app/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/Models/'.$stub)); |
|
84 | + File::put(base_path('app/').str_replace('stub', 'php', $stub), File::get(__DIR__.'/../../stubs/Models/'.$stub)); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | 88 | protected function routeViewCreate() |
89 | 89 | { |
90 | - File::append(base_path('routes/web.php'),File::get(__DIR__.'/../../stubs/routesweb.stub')); |
|
91 | - File::append(base_path('routes/api.php'),File::get(__DIR__.'/../../stubs/routesapi.stub')); |
|
90 | + File::append(base_path('routes/web.php'), File::get(__DIR__.'/../../stubs/routesweb.stub')); |
|
91 | + File::append(base_path('routes/api.php'), File::get(__DIR__.'/../../stubs/routesapi.stub')); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | protected function seedsViewCreate() |
95 | 95 | { |
96 | - foreach($this->stubsSeeds['seeds'] as $stub) |
|
96 | + foreach ($this->stubsSeeds['seeds'] as $stub) |
|
97 | 97 | { |
98 | - File::put(base_path('database/seeds/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/seeds/'.$stub)); |
|
98 | + File::put(base_path('database/seeds/').str_replace('stub', 'php', $stub), File::get(__DIR__.'/../../stubs/seeds/'.$stub)); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |
@@ -41,11 +41,11 @@ |
||
41 | 41 | */ |
42 | 42 | public function register() |
43 | 43 | { |
44 | - $this->app->singleton('epormas', function ($app) { |
|
44 | + $this->app->singleton('epormas', function($app) { |
|
45 | 45 | return new Epormas; |
46 | 46 | }); |
47 | 47 | |
48 | - $this->app->singleton('command.epormas', function ($app) { |
|
48 | + $this->app->singleton('command.epormas', function($app) { |
|
49 | 49 | return new EpormasCommand; |
50 | 50 | }); |
51 | 51 |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | { |
18 | 18 | //Pegawai Epormas |
19 | 19 | $grafikepormascounter = DB::table('epormas_counter') |
20 | - ->select('tahun','bulan','city_id', DB::raw('SUM(count) as count')) |
|
21 | - ->whereNull('deleted_at')->groupBy('tahun','bulan','city_id')->orderBy('bulan')->get(); |
|
20 | + ->select('tahun', 'bulan', 'city_id', DB::raw('SUM(count) as count')) |
|
21 | + ->whereNull('deleted_at')->groupBy('tahun', 'bulan', 'city_id')->orderBy('bulan')->get(); |
|
22 | 22 | $grafiktahunepormascounter = DB::table('epormas_counter') |
23 | 23 | ->select('tahun', DB::raw('SUM(count) as count')) |
24 | 24 | ->whereNull('deleted_at')->groupBy('tahun')->orderBy('tahun')->get(); |
@@ -40,51 +40,51 @@ discard block |
||
40 | 40 | $grafikbulanepormascounter = []; |
41 | 41 | $grafiktotalepormascounter = []; |
42 | 42 | $grafikpieepormascounter = []; |
43 | - for($q=0; $q<$countgrafiktahunepormascounter; $q++){ |
|
43 | + for ($q = 0; $q < $countgrafiktahunepormascounter; $q++) { |
|
44 | 44 | $tahungrafikepormascounter = $grafiktahunepormascounter[$q]->tahun; |
45 | 45 | $gcountepormascounter = (int)$grafiktahunepormascounter[$q]->count; |
46 | 46 | $totaldataepormascounter = $gcountepormascounter; |
47 | - array_push($datagrafiktahunepormascounter,$tahungrafikepormascounter); |
|
48 | - array_push($datagrafikcountepormascounter,$gcountepormascounter); |
|
49 | - array_push($datagrafiktotalepormascounter,$totaldataepormascounter); |
|
47 | + array_push($datagrafiktahunepormascounter, $tahungrafikepormascounter); |
|
48 | + array_push($datagrafikcountepormascounter, $gcountepormascounter); |
|
49 | + array_push($datagrafiktotalepormascounter, $totaldataepormascounter); |
|
50 | 50 | |
51 | - for($kota=1; $kota<=$countcity; $kota++){ |
|
52 | - for ($index=0; $index<12; $index++) { |
|
51 | + for ($kota = 1; $kota <= $countcity; $kota++) { |
|
52 | + for ($index = 0; $index < 12; $index++) { |
|
53 | 53 | $grafikcountepormascounter[$q][$kota][$index] = 0; |
54 | 54 | $grafikbulanepormascounter[$q][$kota][$index] = 0; |
55 | 55 | $grafiktotalepormascounter[$q][$kota][$index] = 0; |
56 | - $grafikpieepormascounter[$q][$kota][$index] = ['value'=>0,'name'=>$namaBulan[$index]]; |
|
56 | + $grafikpieepormascounter[$q][$kota][$index] = ['value'=>0, 'name'=>$namaBulan[$index]]; |
|
57 | 57 | $totaldatagrafikepormascounter[$q][$index] = 0; |
58 | 58 | } |
59 | 59 | } |
60 | - for($r=0; $r<$countgrafikepormascounter; $r++){ |
|
60 | + for ($r = 0; $r < $countgrafikepormascounter; $r++) { |
|
61 | 61 | $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
62 | 62 | $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
63 | 63 | $city_id = $grafikepormascounter[$r]->city_id; |
64 | - if($bulansepormascounter < 10){ |
|
65 | - $bulanepormascounter = substr($bulansepormascounter,1); |
|
64 | + if ($bulansepormascounter < 10) { |
|
65 | + $bulanepormascounter = substr($bulansepormascounter, 1); |
|
66 | 66 | }else { |
67 | 67 | $bulanepormascounter = $bulansepormascounter; |
68 | 68 | } |
69 | - if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
69 | + if ($tahungrafikepormascounter == $tahunsepormascounter) { |
|
70 | 70 | $totaldatagrafikepormascounter[$q][$bulanepormascounter-1] += $grafikepormascounter[$r]->count; |
71 | 71 | } |
72 | 72 | } |
73 | - for($r=0; $r<$countgrafikepormascounter; $r++){ |
|
73 | + for ($r = 0; $r < $countgrafikepormascounter; $r++) { |
|
74 | 74 | $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
75 | 75 | $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
76 | 76 | $city_id = $grafikepormascounter[$r]->city_id; |
77 | - if($bulansepormascounter < 10){ |
|
78 | - $bulanepormascounter = substr($bulansepormascounter,1); |
|
77 | + if ($bulansepormascounter < 10) { |
|
78 | + $bulanepormascounter = substr($bulansepormascounter, 1); |
|
79 | 79 | }else { |
80 | 80 | $bulanepormascounter = $bulansepormascounter; |
81 | 81 | } |
82 | - if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
82 | + if ($tahungrafikepormascounter == $tahunsepormascounter) { |
|
83 | 83 | $grafikcountepormascounter[$q][$city_id][$bulanepormascounter-1] = (int)$grafikepormascounter[$r]->count; |
84 | 84 | $grafikbulanepormascounter[$q][$city_id][$bulanepormascounter-1] = $grafikepormascounter[$r]->bulan; |
85 | 85 | $totaldatagrafikepormascounters = $totaldatagrafikepormascounter[$q][$bulanepormascounter-1]; |
86 | 86 | $grafiktotalepormascounter[$q][$city_id][$bulanepormascounter-1] = $totaldatagrafikepormascounters; |
87 | - $grafikpieepormascounter[$q][$city_id][$bulanepormascounter-1] = ['value'=>$totaldatagrafikepormascounters,'name'=>$namaBulan[$bulanepormascounter-1]]; |
|
87 | + $grafikpieepormascounter[$q][$city_id][$bulanepormascounter-1] = ['value'=>$totaldatagrafikepormascounters, 'name'=>$namaBulan[$bulanepormascounter-1]]; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('epormas')) { |
|
3 | +if (!function_exists('epormas')) { |
|
4 | 4 | function epormas() |
5 | 5 | { |
6 | 6 | return 'Welcome to function epormas() for Dashboard\Epormas package'; |
@@ -67,18 +67,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -106,18 +106,18 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return Response |
108 | 108 | */ |
109 | - public function store(Request $request, $version='') |
|
109 | + public function store(Request $request, $version = '') |
|
110 | 110 | { |
111 | 111 | $path = \Request::path(); |
112 | 112 | $explode = explode('/', $path); |
113 | 113 | |
114 | 114 | $from = 'form'; |
115 | - if(in_array('api',$explode)){ |
|
115 | + if (in_array('api', $explode)) { |
|
116 | 116 | $from = 'api'; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $via = $from; |
120 | - if($version != '' && $version != 'store'){ |
|
120 | + if ($version != '' && $version != 'store') { |
|
121 | 121 | $via .= '-'.$version; |
122 | 122 | } |
123 | 123 | |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | )); |
138 | 138 | } |
139 | 139 | |
140 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal))); |
|
140 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal))); |
|
141 | 141 | $resultcek = EpormasCounter::whereNull('deleted_at') |
142 | - ->where('tanggal','like','%'.$format.'%') |
|
143 | - ->where('category_id',$request->category_id) |
|
144 | - ->where('city_id',$request->city_id) |
|
145 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
142 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
143 | + ->where('category_id', $request->category_id) |
|
144 | + ->where('city_id', $request->city_id) |
|
145 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
146 | 146 | ->orderBy('bulan') |
147 | 147 | ->count(); |
148 | - if($resultcek > 0){ |
|
148 | + if ($resultcek > 0) { |
|
149 | 149 | return Response::json(array( |
150 | 150 | 'title' => 'Error', |
151 | 151 | 'type' => 'error', |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | )); |
154 | 154 | } |
155 | 155 | |
156 | - $date = explode("-",$format); |
|
156 | + $date = explode("-", $format); |
|
157 | 157 | $data = EpormasCounter::whereNull('deleted_at') |
158 | 158 | ->where('tahun', $date[0]) |
159 | 159 | ->where('bulan', $date[1]) |
160 | - ->where('category_id',$request->category_id) |
|
161 | - ->where('city_id',$request->city_id) |
|
162 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
160 | + ->where('category_id', $request->category_id) |
|
161 | + ->where('city_id', $request->city_id) |
|
162 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
163 | 163 | ->orderBy('bulan') |
164 | 164 | ->count(); |
165 | - if($data > 0){ |
|
165 | + if ($data > 0) { |
|
166 | 166 | return Response::json(array( |
167 | 167 | 'title' => 'Error', |
168 | 168 | 'type' => 'error', |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param int $id |
219 | 219 | * @return Response |
220 | 220 | */ |
221 | - public function show($version='', $id) |
|
221 | + public function show($version = '', $id) |
|
222 | 222 | { |
223 | 223 | try { |
224 | 224 | $error = false; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @param int $id |
319 | 319 | * @return Response |
320 | 320 | */ |
321 | - public function update(Request $request, $version='', $id) |
|
321 | + public function update(Request $request, $version = '', $id) |
|
322 | 322 | { |
323 | 323 | $result = EpormasCounter::whereNull('deleted_at') |
324 | 324 | ->with('getCity') |
@@ -341,16 +341,16 @@ discard block |
||
341 | 341 | )); |
342 | 342 | } |
343 | 343 | |
344 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal))); |
|
345 | - if($result->city_id != $request->city_id || $result->category_id != $request->category_id){ |
|
344 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal))); |
|
345 | + if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) { |
|
346 | 346 | $resultcek = EpormasCounter::whereNull('deleted_at') |
347 | - ->where('tanggal','like','%'.$format.'%') |
|
348 | - ->where('category_id',$request->category_id) |
|
349 | - ->where('city_id',$request->city_id) |
|
350 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
347 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
348 | + ->where('category_id', $request->category_id) |
|
349 | + ->where('city_id', $request->city_id) |
|
350 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
351 | 351 | ->orderBy('bulan') |
352 | 352 | ->count(); |
353 | - if($resultcek > 0){ |
|
353 | + if ($resultcek > 0) { |
|
354 | 354 | return Response::json(array( |
355 | 355 | 'title' => 'Error', |
356 | 356 | 'type' => 'error', |
@@ -359,17 +359,17 @@ discard block |
||
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | - $date = explode("-",$format); |
|
362 | + $date = explode("-", $format); |
|
363 | 363 | $dates = date('Y-m-d', strtotime($result->tanggal)); |
364 | - if($dates != $format){ |
|
364 | + if ($dates != $format) { |
|
365 | 365 | $resultcek = EpormasCounter::whereNull('deleted_at') |
366 | - ->where('category_id',$request->category_id) |
|
367 | - ->where('city_id',$request->city_id) |
|
368 | - ->where('tanggal','like','%'.$format.'%') |
|
369 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
366 | + ->where('category_id', $request->category_id) |
|
367 | + ->where('city_id', $request->city_id) |
|
368 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
369 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
370 | 370 | ->orderBy('bulan') |
371 | 371 | ->count(); |
372 | - if($resultcek > 0){ |
|
372 | + if ($resultcek > 0) { |
|
373 | 373 | return Response::json(array( |
374 | 374 | 'title' => 'Error', |
375 | 375 | 'type' => 'error', |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | $data = EpormasCounter::whereNull('deleted_at') |
381 | 381 | ->where('tahun', $date[0]) |
382 | 382 | ->where('bulan', $date[1]) |
383 | - ->where('category_id',$request->category_id) |
|
384 | - ->where('city_id',$request->city_id) |
|
385 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
383 | + ->where('category_id', $request->category_id) |
|
384 | + ->where('city_id', $request->city_id) |
|
385 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
386 | 386 | ->orderBy('bulan') |
387 | 387 | ->count(); |
388 | - if($data > 0){ |
|
388 | + if ($data > 0) { |
|
389 | 389 | return Response::json(array( |
390 | 390 | 'title' => 'Error', |
391 | 391 | 'type' => 'error', |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | |
400 | 400 | $from = $result->via; |
401 | 401 | $user_id = $result->user_id; |
402 | - if(in_array('api',$explode)){ |
|
402 | + if (in_array('api', $explode)) { |
|
403 | 403 | $from = 'api'; |
404 | 404 | $user_id = $request->user_id; |
405 | 405 | } |
406 | 406 | |
407 | 407 | $via = $from; |
408 | - if($version != '' && $version != 'update'){ |
|
408 | + if ($version != '' && $version != 'update') { |
|
409 | 409 | $via .= '-'.$version; |
410 | 410 | } |
411 | 411 |
@@ -67,18 +67,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |