|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Bantenprov\DashboardEpormas\Http\Controllers; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
|
|
6
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
|
|
7
|
|
|
use Illuminate\Support\Facades\DB; |
|
8
|
|
|
use Illuminate\Support\Facades\Input; |
|
9
|
|
|
use Bantenprov\DashboardEpormas\Models\EpormasCounter; |
|
10
|
|
|
use Bantenprov\DashboardEpormas\Models\EpormasCategory; |
|
11
|
|
|
use Bantenprov\DashboardEpormas\Models\EpormasCity; |
|
12
|
|
|
use Validator, Image, Session, File, Response, Redirect, Exception; |
|
13
|
|
|
|
|
14
|
|
|
class DashboardEpormasController extends Controller |
|
15
|
|
|
{ |
|
16
|
|
|
public function epormas() |
|
17
|
|
|
{ |
|
18
|
|
|
//Pegawai Epormas |
|
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(); |
|
22
|
|
|
$grafiktahunepormascounter = DB::table('epormas_counter') |
|
23
|
|
|
->select('tahun', DB::raw('SUM(count) as count')) |
|
24
|
|
|
->whereNull('deleted_at')->groupBy('tahun')->orderBy('tahun')->get(); |
|
25
|
|
|
|
|
26
|
|
|
$namaBulan = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); |
|
27
|
|
|
$namaBulans = array('Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'); |
|
28
|
|
|
$city = EpormasCity::all(); |
|
29
|
|
|
$category = EpormasCategory::all(); |
|
30
|
|
|
$countcity = count($city); |
|
31
|
|
|
$countcategory = count($category); |
|
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
$countgrafikepormascounter = count($grafikepormascounter); |
|
34
|
|
|
$countgrafiktahunepormascounter = count($grafiktahunepormascounter); |
|
35
|
|
|
$datagrafikepormascounter = []; |
|
|
|
|
|
|
36
|
|
|
$datagrafiktahunepormascounter = []; |
|
37
|
|
|
$datagrafikcountepormascounter = []; |
|
38
|
|
|
$datagrafiktotalepormascounter = []; |
|
39
|
|
|
$grafikcountepormascounter = []; |
|
40
|
|
|
$grafikbulanepormascounter = []; |
|
41
|
|
|
$grafiktotalepormascounter = []; |
|
42
|
|
|
$grafikpieepormascounter = []; |
|
43
|
|
|
for($q=0; $q<$countgrafiktahunepormascounter; $q++){ |
|
44
|
|
|
$tahungrafikepormascounter = $grafiktahunepormascounter[$q]->tahun; |
|
45
|
|
|
$gcountepormascounter = (int)$grafiktahunepormascounter[$q]->count; |
|
46
|
|
|
$totaldataepormascounter = $gcountepormascounter; |
|
47
|
|
|
array_push($datagrafiktahunepormascounter,$tahungrafikepormascounter); |
|
48
|
|
|
array_push($datagrafikcountepormascounter,$gcountepormascounter); |
|
49
|
|
|
array_push($datagrafiktotalepormascounter,$totaldataepormascounter); |
|
50
|
|
|
|
|
51
|
|
|
for($kota=1; $kota<=$countcity; $kota++){ |
|
52
|
|
|
for ($index=0; $index<12; $index++) { |
|
53
|
|
|
$grafikcountepormascounter[$q][$kota][$index] = 0; |
|
54
|
|
|
$grafikbulanepormascounter[$q][$kota][$index] = 0; |
|
55
|
|
|
$grafiktotalepormascounter[$q][$kota][$index] = 0; |
|
56
|
|
|
$grafikpieepormascounter[$q][$kota][$index] = ['value'=>0,'name'=>$namaBulan[$index]]; |
|
57
|
|
|
$totaldatagrafikepormascounter[$q][$index] = 0; |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
for($r=0; $r<$countgrafikepormascounter; $r++){ |
|
61
|
|
|
$tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
|
62
|
|
|
$bulansepormascounter = $grafikepormascounter[$r]->bulan; |
|
63
|
|
|
$city_id = $grafikepormascounter[$r]->city_id; |
|
|
|
|
|
|
64
|
|
|
if($bulansepormascounter < 10){ |
|
65
|
|
|
$bulanepormascounter = substr($bulansepormascounter,1); |
|
66
|
|
|
}else { |
|
67
|
|
|
$bulanepormascounter = $bulansepormascounter; |
|
68
|
|
|
} |
|
69
|
|
|
if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
70
|
|
|
$totaldatagrafikepormascounter[$q][$bulanepormascounter-1] += $grafikepormascounter[$r]->count; |
|
|
|
|
|
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
for($r=0; $r<$countgrafikepormascounter; $r++){ |
|
74
|
|
|
$tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
|
75
|
|
|
$bulansepormascounter = $grafikepormascounter[$r]->bulan; |
|
76
|
|
|
$city_id = $grafikepormascounter[$r]->city_id; |
|
77
|
|
|
if($bulansepormascounter < 10){ |
|
78
|
|
|
$bulanepormascounter = substr($bulansepormascounter,1); |
|
79
|
|
|
}else { |
|
80
|
|
|
$bulanepormascounter = $bulansepormascounter; |
|
81
|
|
|
} |
|
82
|
|
|
if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
83
|
|
|
$grafikcountepormascounter[$q][$city_id][$bulanepormascounter-1] = (int)$grafikepormascounter[$r]->count; |
|
84
|
|
|
$grafikbulanepormascounter[$q][$city_id][$bulanepormascounter-1] = $grafikepormascounter[$r]->bulan; |
|
85
|
|
|
$totaldatagrafikepormascounters = $totaldatagrafikepormascounter[$q][$bulanepormascounter-1]; |
|
86
|
|
|
$grafiktotalepormascounter[$q][$city_id][$bulanepormascounter-1] = $totaldatagrafikepormascounters; |
|
87
|
|
|
$grafikpieepormascounter[$q][$city_id][$bulanepormascounter-1] = ['value'=>$totaldatagrafikepormascounters,'name'=>$namaBulan[$bulanepormascounter-1]]; |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
$chartgrafikcountepormascounter = ['chartdata'=>$grafikcountepormascounter]; |
|
92
|
|
|
$datagrafikepormascounter = ['count'=>$grafikcountepormascounter, 'bulan'=>$grafikbulanepormascounter, 'namabulan'=>$namaBulan, 'namabulans'=>$namaBulans, 'kategori'=>$category, 'kota'=>$city, 'total'=>$grafiktotalepormascounter, 'datatahun'=>['tahun'=>$datagrafiktahunepormascounter, 'count'=>$datagrafikcountepormascounter, 'totaldata'=>$datagrafiktotalepormascounter], 'datapie'=>$grafikpieepormascounter, 'seriesdata'=>[$chartgrafikcountepormascounter]]; |
|
93
|
|
|
//end Pegawai Epormas |
|
94
|
|
|
|
|
95
|
|
|
return Response::json(array( |
|
96
|
|
|
//Jumlah Penduduk |
|
97
|
|
|
'datachartepormascounter' => $datagrafikepormascounter |
|
98
|
|
|
//end Jumlah Penduduk |
|
99
|
|
|
)); |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths