@@ -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'; |
@@ -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 |