@@ -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 | } |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return Response |
52 | 52 | */ |
53 | - public function store(Request $request, $version='') |
|
53 | + public function store(Request $request, $version = '') |
|
54 | 54 | { |
55 | 55 | $path = \Request::path(); |
56 | 56 | $explode = explode('/', $path); |
57 | 57 | |
58 | 58 | $from = 'form'; |
59 | - if(in_array('api',$explode)){ |
|
59 | + if (in_array('api', $explode)) { |
|
60 | 60 | $from = 'api'; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $via = $from; |
64 | - if($version != '' && $version != 'store'){ |
|
64 | + if ($version != '' && $version != 'store') { |
|
65 | 65 | $via .= '-'.$version; |
66 | 66 | } |
67 | 67 | |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | ]); |
82 | 82 | } |
83 | 83 | |
84 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal))); |
|
84 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal))); |
|
85 | 85 | $resultcek = EpormasCounter::whereNull('deleted_at') |
86 | - ->where('tanggal','like','%'.$format.'%') |
|
87 | - ->where('category_id',$request->category_id) |
|
88 | - ->where('city_id',$request->city_id) |
|
89 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
86 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
87 | + ->where('category_id', $request->category_id) |
|
88 | + ->where('city_id', $request->city_id) |
|
89 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
90 | 90 | ->orderBy('bulan') |
91 | 91 | ->count(); |
92 | - if($resultcek > 0){ |
|
92 | + if ($resultcek > 0) { |
|
93 | 93 | return response()->json([ |
94 | 94 | 'title' => 'Error', |
95 | 95 | 'type' => 'error', |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | ]); |
98 | 98 | } |
99 | 99 | |
100 | - $date = explode("-",$format); |
|
100 | + $date = explode("-", $format); |
|
101 | 101 | $data = EpormasCounter::whereNull('deleted_at') |
102 | 102 | ->where('tahun', $date[0]) |
103 | 103 | ->where('bulan', $date[1]) |
104 | - ->where('category_id',$request->category_id) |
|
105 | - ->where('city_id',$request->city_id) |
|
106 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
104 | + ->where('category_id', $request->category_id) |
|
105 | + ->where('city_id', $request->city_id) |
|
106 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
107 | 107 | ->orderBy('bulan') |
108 | 108 | ->count(); |
109 | - if($data > 0){ |
|
109 | + if ($data > 0) { |
|
110 | 110 | return response()->json([ |
111 | 111 | 'title' => 'Error', |
112 | 112 | 'type' => 'error', |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param int $id |
139 | 139 | * @return Response |
140 | 140 | */ |
141 | - public function show($version='', $id) |
|
141 | + public function show($version = '', $id) |
|
142 | 142 | { |
143 | 143 | $result = EpormasCounter::whereNull('deleted_at') |
144 | 144 | ->with('getCity') |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param int $id |
179 | 179 | * @return Response |
180 | 180 | */ |
181 | - public function update(Request $request, $version='', $id) |
|
181 | + public function update(Request $request, $version = '', $id) |
|
182 | 182 | { |
183 | 183 | $result = EpormasCounter::whereNull('deleted_at') |
184 | 184 | ->with('getCity') |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | ]); |
202 | 202 | } |
203 | 203 | |
204 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal))); |
|
205 | - if($result->city_id != $request->city_id || $result->category_id != $request->category_id){ |
|
204 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal))); |
|
205 | + if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) { |
|
206 | 206 | $resultcek = EpormasCounter::whereNull('deleted_at') |
207 | - ->where('tanggal','like','%'.$format.'%') |
|
208 | - ->where('category_id',$request->category_id) |
|
209 | - ->where('city_id',$request->city_id) |
|
210 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
207 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
208 | + ->where('category_id', $request->category_id) |
|
209 | + ->where('city_id', $request->city_id) |
|
210 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
211 | 211 | ->orderBy('bulan') |
212 | 212 | ->count(); |
213 | - if($resultcek > 0){ |
|
213 | + if ($resultcek > 0) { |
|
214 | 214 | return response()->json([ |
215 | 215 | 'title' => 'Error', |
216 | 216 | 'type' => 'error', |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - $date = explode("-",$format); |
|
222 | + $date = explode("-", $format); |
|
223 | 223 | $dates = date('Y-m-d', strtotime($result->tanggal)); |
224 | - if($dates != $format){ |
|
224 | + if ($dates != $format) { |
|
225 | 225 | $resultcek = EpormasCounter::whereNull('deleted_at') |
226 | - ->where('category_id',$request->category_id) |
|
227 | - ->where('city_id',$request->city_id) |
|
228 | - ->where('tanggal','like','%'.$format.'%') |
|
229 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
226 | + ->where('category_id', $request->category_id) |
|
227 | + ->where('city_id', $request->city_id) |
|
228 | + ->where('tanggal', 'like', '%'.$format.'%') |
|
229 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
230 | 230 | ->orderBy('bulan') |
231 | 231 | ->count(); |
232 | - if($resultcek > 0){ |
|
232 | + if ($resultcek > 0) { |
|
233 | 233 | return response()->json([ |
234 | 234 | 'title' => 'Error', |
235 | 235 | 'type' => 'error', |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | $data = EpormasCounter::whereNull('deleted_at') |
241 | 241 | ->where('tahun', $date[0]) |
242 | 242 | ->where('bulan', $date[1]) |
243 | - ->where('category_id',$request->category_id) |
|
244 | - ->where('city_id',$request->city_id) |
|
245 | - ->groupBy('tahun','bulan','category_id','city_id') |
|
243 | + ->where('category_id', $request->category_id) |
|
244 | + ->where('city_id', $request->city_id) |
|
245 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id') |
|
246 | 246 | ->orderBy('bulan') |
247 | 247 | ->count(); |
248 | - if($data > 0){ |
|
248 | + if ($data > 0) { |
|
249 | 249 | return response()->json([ |
250 | 250 | 'title' => 'Error', |
251 | 251 | 'type' => 'error', |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | $from = $result->via; |
261 | 261 | $user_id = $result->user_id; |
262 | - if(in_array('api',$explode)){ |
|
262 | + if (in_array('api', $explode)) { |
|
263 | 263 | $from = 'api'; |
264 | 264 | $user_id = $request->user_id; |
265 | 265 | } |
266 | 266 | |
267 | 267 | $via = $from; |
268 | - if($version != '' && $version != 'update'){ |
|
268 | + if ($version != '' && $version != 'update') { |
|
269 | 269 | $via .= '-'.$version; |
270 | 270 | } |
271 | 271 |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return Response |
42 | 42 | */ |
43 | - public function store(Request $request, $version='') |
|
43 | + public function store(Request $request, $version = '') |
|
44 | 44 | { |
45 | 45 | $path = \Request::path(); |
46 | 46 | $explode = explode('/', $path); |
47 | 47 | |
48 | 48 | $from = 'form'; |
49 | - if(in_array('api',$explode)){ |
|
49 | + if (in_array('api', $explode)) { |
|
50 | 50 | $from = 'api'; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $via = $from; |
54 | - if($version != '' && $version != 'store'){ |
|
54 | + if ($version != '' && $version != 'store') { |
|
55 | 55 | $via .= '-'.$version; |
56 | 56 | } |
57 | 57 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $data = EpormasCategory::whereNull('deleted_at') |
72 | 72 | ->where('name', $request->name) |
73 | 73 | ->count(); |
74 | - if($data > 0){ |
|
74 | + if ($data > 0) { |
|
75 | 75 | return response()->json([ |
76 | 76 | 'title' => 'Error', |
77 | 77 | 'type' => 'error', |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param int $id |
97 | 97 | * @return Response |
98 | 98 | */ |
99 | - public function show($version='', $id) |
|
99 | + public function show($version = '', $id) |
|
100 | 100 | { |
101 | 101 | $result = EpormasCategory::find($id); |
102 | 102 | return response()->json([ |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param int $id |
125 | 125 | * @return Response |
126 | 126 | */ |
127 | - public function update(Request $request, $version='', $id) |
|
127 | + public function update(Request $request, $version = '', $id) |
|
128 | 128 | { |
129 | 129 | $result = EpormasCategory::find($id); |
130 | 130 | |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | ]); |
142 | 142 | } |
143 | 143 | |
144 | - if($request->name != $result->name){ |
|
144 | + if ($request->name != $result->name) { |
|
145 | 145 | $data = EpormasCategory::whereNull('deleted_at') |
146 | 146 | ->where('name', $request->name) |
147 | 147 | ->count(); |
148 | - if($data > 0){ |
|
148 | + if ($data > 0) { |
|
149 | 149 | return response()->json([ |
150 | 150 | 'title' => 'Error', |
151 | 151 | 'type' => 'error', |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | $explode = explode('/', $path); |
159 | 159 | |
160 | 160 | $from = 'form'; |
161 | - if(in_array('api',$explode)){ |
|
161 | + if (in_array('api', $explode)) { |
|
162 | 162 | $from = 'api'; |
163 | 163 | } |
164 | 164 | |
165 | 165 | $via = $from; |
166 | - if($version != '' && $version != 'update'){ |
|
166 | + if ($version != '' && $version != 'update') { |
|
167 | 167 | $via .= '-'.$version; |
168 | 168 | } |
169 | 169 |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return Response |
42 | 42 | */ |
43 | - public function store(Request $request, $version='') |
|
43 | + public function store(Request $request, $version = '') |
|
44 | 44 | { |
45 | 45 | $path = \Request::path(); |
46 | 46 | $explode = explode('/', $path); |
47 | 47 | |
48 | 48 | $from = 'form'; |
49 | - if(in_array('api',$explode)){ |
|
49 | + if (in_array('api', $explode)) { |
|
50 | 50 | $from = 'api'; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $via = $from; |
54 | - if($version != '' && $version != 'store'){ |
|
54 | + if ($version != '' && $version != 'store') { |
|
55 | 55 | $via .= '-'.$version; |
56 | 56 | } |
57 | 57 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $data = EpormasCity::whereNull('deleted_at') |
72 | 72 | ->where('name', $request->name) |
73 | 73 | ->count(); |
74 | - if($data > 0){ |
|
74 | + if ($data > 0) { |
|
75 | 75 | return response()->json([ |
76 | 76 | 'title' => 'Error', |
77 | 77 | 'type' => 'error', |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param int $id |
97 | 97 | * @return Response |
98 | 98 | */ |
99 | - public function show($version='', $id) |
|
99 | + public function show($version = '', $id) |
|
100 | 100 | { |
101 | 101 | $result = EpormasCity::find($id); |
102 | 102 | return response()->json([ |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param int $id |
125 | 125 | * @return Response |
126 | 126 | */ |
127 | - public function update(Request $request, $version='', $id) |
|
127 | + public function update(Request $request, $version = '', $id) |
|
128 | 128 | { |
129 | 129 | $result = EpormasCity::find($id); |
130 | 130 | |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | ]); |
142 | 142 | } |
143 | 143 | |
144 | - if($request->name != $result->name){ |
|
144 | + if ($request->name != $result->name) { |
|
145 | 145 | $data = EpormasCity::whereNull('deleted_at') |
146 | 146 | ->where('name', $request->name) |
147 | 147 | ->count(); |
148 | - if($data > 0){ |
|
148 | + if ($data > 0) { |
|
149 | 149 | return response()->json([ |
150 | 150 | 'title' => 'Error', |
151 | 151 | 'type' => 'error', |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | $explode = explode('/', $path); |
159 | 159 | |
160 | 160 | $from = 'form'; |
161 | - if(in_array('api',$explode)){ |
|
161 | + if (in_array('api', $explode)) { |
|
162 | 162 | $from = 'api'; |
163 | 163 | } |
164 | 164 | |
165 | 165 | $via = $from; |
166 | - if($version != '' && $version != 'update'){ |
|
166 | + if ($version != '' && $version != 'update') { |
|
167 | 167 | $via .= '-'.$version; |
168 | 168 | } |
169 | 169 |
@@ -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'; |