Passed
Push — master ( 01aab9...c7d9bb )
by
unknown
10:46
created
src/Console/Commands/EpormasCommand.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -71,31 +71,31 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/EpormasServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Http/Controllers/DashboardEpormasController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
       }
Please login to merge, or discard this patch.
src/helpers/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
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';
Please login to merge, or discard this patch.
src/Http/Controllers/EpormasCategoryController.php 1 patch
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.
src/Http/Controllers/EpormasCityController.php 1 patch
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.
src/Http/Controllers/EpormasCounterController.php 1 patch
Spacing   +37 added lines, -37 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,15 +122,15 @@  discard block
 block discarded – undo
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(array(
135 135
               'title' => 'Error',
136 136
               'type'  => 'error',
@@ -138,16 +138,16 @@  discard block
 block discarded – undo
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(array(
152 152
               'title' => 'Error',
153 153
               'type'  => 'error',
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
    * @param  int  $id
187 187
    * @return Response
188 188
    */
189
-  public function show($version='', $id)
189
+  public function show($version = '', $id)
190 190
   {
191 191
         try {
192 192
             $error = false;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                             ->with('getCity')
238 238
                             ->with('getCategory')
239 239
                             ->find($id);
240
-            if($result->tanggal){
240
+            if ($result->tanggal) {
241 241
               $format = date('Y-m-d', strtotime($result->tanggal));
242 242
             }else {
243 243
               $format = 'Not Found';
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
    * @param  int  $id
275 275
    * @return Response
276 276
    */
277
-  public function update(Request $request, $version='', $id)
277
+  public function update(Request $request, $version = '', $id)
278 278
   {
279 279
         $result = EpormasCounter::whereNull('deleted_at')
280 280
                         ->with('getCity')
@@ -297,16 +297,16 @@  discard block
 block discarded – undo
297 297
           ));
298 298
         }
299 299
 
300
-        $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
301
-        if($result->city_id != $request->city_id || $result->category_id != $request->category_id){
300
+        $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
301
+        if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) {
302 302
             $resultcek = EpormasCounter::whereNull('deleted_at')
303
-                                 ->where('tanggal','like','%'.$format.'%')
304
-            		                 ->where('category_id',$request->category_id)
305
-            		                 ->where('city_id',$request->city_id)
306
-                                 ->groupBy('tahun','bulan','category_id','city_id')
303
+                                 ->where('tanggal', 'like', '%'.$format.'%')
304
+            		                 ->where('category_id', $request->category_id)
305
+            		                 ->where('city_id', $request->city_id)
306
+                                 ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
307 307
                                  ->orderBy('bulan')
308 308
                                  ->count();
309
-            if($resultcek > 0){
309
+            if ($resultcek > 0) {
310 310
               return Response::json(array(
311 311
                   'title' => 'Error',
312 312
                   'type'  => 'error',
@@ -315,17 +315,17 @@  discard block
 block discarded – undo
315 315
             }
316 316
         }
317 317
 
318
-        $date = explode("-",$format);
318
+        $date = explode("-", $format);
319 319
         $dates = date('Y-m-d', strtotime($result->tanggal));
320
-        if($dates != $format){
320
+        if ($dates != $format) {
321 321
             $resultcek = EpormasCounter::whereNull('deleted_at')
322
-            		                 ->where('category_id',$request->category_id)
323
-            		                 ->where('city_id',$request->city_id)
324
-                                 ->where('tanggal','like','%'.$format.'%')
325
-                                 ->groupBy('tahun','bulan','category_id','city_id')
322
+            		                 ->where('category_id', $request->category_id)
323
+            		                 ->where('city_id', $request->city_id)
324
+                                 ->where('tanggal', 'like', '%'.$format.'%')
325
+                                 ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
326 326
                                  ->orderBy('bulan')
327 327
                                  ->count();
328
-            if($resultcek > 0){
328
+            if ($resultcek > 0) {
329 329
               return Response::json(array(
330 330
                   'title' => 'Error',
331 331
                   'type'  => 'error',
@@ -336,12 +336,12 @@  discard block
 block discarded – undo
336 336
             $data = EpormasCounter::whereNull('deleted_at')
337 337
                            ->where('tahun', $date[0])
338 338
                            ->where('bulan', $date[1])
339
-            		           ->where('category_id',$request->category_id)
340
-            		           ->where('city_id',$request->city_id)
341
-                           ->groupBy('tahun','bulan','category_id','city_id')
339
+            		           ->where('category_id', $request->category_id)
340
+            		           ->where('city_id', $request->city_id)
341
+                           ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
342 342
                            ->orderBy('bulan')
343 343
                            ->count();
344
-            if($data > 0){
344
+            if ($data > 0) {
345 345
               return Response::json(array(
346 346
                   'title' => 'Error',
347 347
                   'type'  => 'error',
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
 
356 356
         $from = $result->via;
357 357
         $user_id = $result->user_id;
358
-        if(in_array('api',$explode)){
358
+        if (in_array('api', $explode)) {
359 359
           $from = 'api';
360 360
           $user_id = $request->user_id;
361 361
         }
362 362
 
363 363
         $via = $from;
364
-        if($version != '' && $version != 'update'){
364
+        if ($version != '' && $version != 'update') {
365 365
           $via .= '-'.$version;
366 366
         }
367 367
 
Please login to merge, or discard this patch.