Initial commit BLT-DD

This commit is contained in:
Vicky01012004 2026-08-02 12:50:34 +07:00
commit 6987ec468b
199 changed files with 29030 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[compose.yaml]
indent_size = 4

65
.env.example Normal file
View File

@ -0,0 +1,65 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
# PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.fleet
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
Homestead.json
Homestead.yaml
Thumbs.db

View File

@ -0,0 +1,131 @@
PEMERINTAH KABUPATEN MOJOKERTO;;;;;;;;;
KECAMATAN PUNGGING;;;;;;;;;
DESA PUNGGING;;;;;;;;;
Jalan Raya Pungging No. 27 Pungging, Mojokerto, Jawa Timur;;;;;;;;;
Kode Pos 61384, Telp. (0321) 592733;;;;;;;;;
;;;;;;;;;
LAPORAN PELAKSANAAN;;;;;;;;;
BANTUAN LANGSUNG TUNAI (BLT) DANA DESA BULAN DESEMBER (KE-DUA BELAS);;;;;;;;;
TAHUN ANGGARAN 2022;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
NO;NAMA KPM;NIK;MATA PENCAHARIAN;BESARAN BLT DD;TANDA TANGAN;KET;;;
1;SUMARTI;3516067112630011;DAN LAIN-LAIN; Rp300.000 ;1;;;;
2;BUARI;3516063112620088;DAN LAIN-LAIN; Rp300.000 ;2;;;;
3;RUKAYAH;3516064109510001;BURUH TANI; Rp300.000 ;3;;;;
4;GIMO;3516060705590001;DAN LAIN-LAIN; Rp300.000 ;4;;;;
5;MISENI;3516065502530001;DAN LAIN-LAIN; Rp300.000 ;5;;;;
6;SITI JULAIKAH;3516067112650149;DAN LAIN-LAIN; Rp300.000 ;6;;;;
7;SAUDI;3516061008410001;BURUH TANI; Rp300.000 ;7;;;;
8;NUR DIANA;3516067011770001;DAN LAIN-LAIN; Rp300.000 ;8;;;;
9;PARIAMI;3516066810610001;DAN LAIN-LAIN; Rp300.000 ;9;;;;
10;SATUMI;3516064507700001;DAN LAIN-LAIN; Rp300.000 ;10;;;;
11;FEBRI DWI SETIAWAN;3516062602940003;BURUH TANI; Rp300.000 ;11;;;;
12;SUWAIYO;3516060112540001;BURUH TANI; Rp300.000 ;12;;;;
13;SATUNI;3516064607720001;DAN LAIN-LAIN; Rp300.000 ;13;;;;
14;RUPIAH;3516064804590001;PETANI; Rp300.000 ;14;;;;
15;SAMPINI;3516064208500001;DAN LAIN-LAIN; Rp300.000 ;15;;;;
16;NUR HAYATI;3516066702590001;DAN LAIN-LAIN; Rp300.000 ;16;;;;
17;SUGENG DWI PURNOMO;3516060902820001;DAN LAIN-LAIN; Rp300.000 ;17;;;;
18;SATUNI;3516064111560001;DAN LAIN-LAIN; Rp300.000 ;18;;;;
19;SUKARDI;3516062105690002;BURUH TANI; Rp300.000 ;19;;;;
20;KASIMPEN;3516065107450001;DAN LAIN-LAIN; Rp300.000 ;20;;;;
21;JUMADI;3516060202680005;DAN LAIN-LAIN; Rp300.000 ;21;;;;
22;SARDI;3516060107420002;DAN LAIN-LAIN; Rp300.000 ;22;;;;
23;KASIMAH;3516067112440008;BURUH TANI; Rp300.000 ;23;;;;
24;MUH CAHYARUM;3516066303580001;DAN LAIN-LAIN; Rp300.000 ;24;;;;
25;MUTMAINAH;3516064502580002;BURUH TANI; Rp300.000 ;25;;;;
26;NONO SUYATNO;3516060407610001;DAN LAIN-LAIN; Rp300.000 ;26;;;;
27;QIMATUL NANDA INSANI;3516066402030001;DAN LAIN-LAIN; Rp300.000 ;27;;;;
28;SUMANTRI;3516060101510001;DAN LAIN-LAIN; Rp300.000 ;28;;;;
29;SUNARIYAM;3516065009630002;BURUH TANI; Rp300.000 ;29;;;;
30;SULIATI;3516064105680002;DAN LAIN-LAIN; Rp300.000 ;30;;;;
31;LUKMAN;3516060208640001;DAN LAIN-LAIN; Rp300.000 ;31;;;;
32;KARMAN;3516060208420001;BURUH TANI; Rp300.000 ;32;;;;
33;REBIN;3516063112450051;BURUH TANI; Rp300.000 ;33;;;;
34;NGATIMAH;3516065507460001;BURUH TANI; Rp300.000 ;34;;;;
35;MUK'ATI;3516067112530041;BURUH TANI; Rp300.000 ;35;;;;
36;SENIMAH;3516067112580050;BURUH TANI; Rp300.000 ;36;;;;
37;KASIANI;3516064907630003;DAN LAIN-LAIN; Rp300.000 ;37;;;;
38;BUNAH;3516067112500057;DAN LAIN-LAIN; Rp300.000 ;38;;;;
39;FIKI OKTA PAMBUDI;3516060510860002;BURUH TANI; Rp300.000 ;39;;;;
40;YATI;3516067012670001;DAN LAIN-LAIN; Rp300.000 ;40;;;;
41;SULIKAH;3516064109600022;DAN LAIN-LAIN; Rp300.000 ;41;;;;
42;SUYANTO;3516063112610018;BURUH TANI; Rp300.000 ;42;;;;
43;SATIYAH;3516064107570003;DAN LAIN-LAIN; Rp300.000 ;43;;;;
44;SARMAN;3516063112560041;BURUH TANI; Rp300.000 ;44;;;;
45;KASMINI;3516067112420120;BURUH TANI; Rp300.000 ;45;;;;
46;MISNI;3516067112710027;DAN LAIN-LAIN; Rp300.000 ;46;;;;
47;MISNI;3516067112600070;BURUH TANI; Rp300.000 ;47;;;;
48;SUMIYATI;3516065005590003;DAN LAIN-LAIN; Rp300.000 ;48;;;;
49;MUKLISAH;3516066103630001;DAN LAIN-LAIN; Rp300.000 ;49;;;;
50;WIJI UTAMI;3516066811770001;DAN LAIN-LAIN; Rp300.000 ;50;;;;
51;TONDO;3516060403610001;DAN LAIN-LAIN; Rp300.000 ;51;;;;
52;NARIOTO;3516062406740001;BURUH TANI; Rp300.000 ;52;;;;
53;SUTATIK;3516064210740002;BURUH TANI; Rp300.000 ;53;;;;
54;LEGINI;3516064508540001;BURUH TANI; Rp300.000 ;54;;;;
55;SATUNING;3516067112630020;DAN LAIN-LAIN; Rp300.000 ;55;;;;
56;SARTI;3516067006560001;BURUH TANI; Rp300.000 ;56;;;;
57;LASERI;3516060510640001;DAN LAIN-LAIN; Rp300.000 ;57;;;;
58;BUSAR;3513140103770004;BURUH TANI; Rp300.000 ;58;;;;
59;JAMIL;3516061506630005;BURUH TANI; Rp300.000 ;59;;;;
60;SUMINI;3516065606610003;BURUH TANI; Rp300.000 ;60;;;;
61;NAIM;3516060109500006;BURUH TANI; Rp300.000 ;61;;;;
62;SISWANTO;3516060810740006;BURUH TANI; Rp300.000 ;62;;;;
63;SIYAM;3516065507650001;DAN LAIN-LAIN; Rp300.000 ;63;;;;
64;WANIYAH;3516067112650021;DAN LAIN-LAIN; Rp300.000 ;64;;;;
65;NURALIM;3516061308610002;DAN LAIN-LAIN; Rp300.000 ;65;;;;
66;BUALI;3516060306650001;BURUH TANI; Rp300.000 ;66;;;;
67;INDAHWATI;3516114406880009;BURUH TANI; Rp300.000 ;67;;;;
68;MOCH KUSEN;3516062804640001;DAN LAIN-LAIN; Rp300.000 ;68;;;;
69;MUCHAIJANAH;3516064901550001;DAN LAIN-LAIN; Rp300.000 ;69;;;;
70;MUHAMMAD SALIM;3516062707800004;BURUH PABRIK; Rp300.000 ;70;;;;
71;MUSLIMIN;3516061006800001;DAN LAIN-LAIN; Rp300.000 ;71;;;;
72;MUKSIN;3516061206280003;BURUH TANI; Rp300.000 ;72;;;;
73;MOH. DENDI. H;3516062701000001;DAN LAIN-LAIN; Rp300.000 ;73;;;;
74;PONITI;3516067112520015;BURUH TANI; Rp300.000 ;74;;;;
75;AHMAD DANU JULIYANTO;3516062007080001;DAN LAIN-LAIN; Rp300.000 ;75;;;;
76;AHMAD WIRAI;3516061911730001;BURUH TANI; Rp300.000 ;76;;;;
77;NING MIASRI;3516064209750001;DAN LAIN-LAIN; Rp300.000 ;77;;;;
78;MUTASLIMAH;3516067112530010;DAN LAIN-LAIN; Rp300.000 ;78;;;;
79;MISERI;3516061404580001;BURUH TANI; Rp300.000 ;79;;;;
80;IFA WAHYUNI;3516064506830004;BURUH TANI; Rp300.000 ;80;;;;
81;MESNAN;3516060912700003;DAN LAIN-LAIN; Rp300.000 ;81;;;;
82;NGATEMI;3516067112430029;DAN LAIN-LAIN; Rp300.000 ;82;;;;
83;MUKHAYAH;3516065603590001;DAN LAIN-LAIN; Rp300.000 ;83;;;;
84;TUNI;3516067112300120;DAN LAIN-LAIN; Rp300.000 ;84;;;;
85;DAUAMAH;3516065008340002;BURUH TANI; Rp300.000 ;85;;;;
86;GINI;3516064107600003;DAN LAIN-LAIN; Rp300.000 ;86;;;;
87;SRIATUN;3516064106650001;DAN LAIN-LAIN; Rp300.000 ;87;;;;
88;WAGINTEN;3516067112500065;DAN LAIN-LAIN; Rp300.000 ;88;;;;
89;SUMIATI;3516067112650147;DAN LAIN-LAIN; Rp300.000 ;89;;;;
90;KARTI;3516067112510040;BURUH TANI; Rp300.000 ;90;;;;
91;SULAIKAH;3516067112520043;BURUH TANI; Rp300.000 ;91;;;;
92;UMIYAH;3516067112650126;DAN LAIN-LAIN; Rp300.000 ;92;;;;
93;LUKIYAH;3516065804740003;BURUH TANI; Rp300.000 ;93;;;;
94;SUMARI;3516063112580048;BURUH TANI; Rp300.000 ;94;;;;
95;SUKARMAN;3516060101560005;DAN LAIN-LAIN; Rp300.000 ;95;;;;
96;KAYATI;3516064101540002;DAN LAIN-LAIN; Rp300.000 ;96;;;;
97;SUTAJI;3516060303600001;DAN LAIN-LAIN; Rp300.000 ;97;;;;
98;JUMANI;3516064506580001;BURUH TANI; Rp300.000 ;98;;;;
99;KANTI;3516065302710003;DAN LAIN-LAIN; Rp300.000 ;99;;;;
100;JUMANING;3516064510660001;DAN LAIN-LAIN; Rp300.000 ;100;;;;
101;MARPU'AH;3516065503650005;BURUH TANI; Rp300.000 ;101;;;;
;;;;;;;;;
REKAP MATA PENCAHARIAN;;;; MOJOKERTO, DESEMBER 2022 ;;;;;
1;PETANI dan BURUH TANI;= 42 Orang;; KEPALA DESA PUNGGING ;;;;;
2;PEDAGANG dan UMKM;= 0 Orang;;;;;;;
3;NELAYAN dan BURUH NELAYAN;= 0 Orang;;;;;;;
4;BURUH PABRIK;= 1 Orang;;;;;;;
5;GURU;= 0 Orang;;P A I M A N;;;;;
6;DAN DAN LAIN-LAIN;= 58 Orang;;;;;;;
;JUMLAH;= 101 Orang;;;;;;;
;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
;;;;;;;;;
1 PEMERINTAH KABUPATEN MOJOKERTO
2 KECAMATAN PUNGGING
3 DESA PUNGGING
4 Jalan Raya Pungging No. 27 Pungging, Mojokerto, Jawa Timur
5 Kode Pos 61384, Telp. (0321) 592733
6
7 LAPORAN PELAKSANAAN
8 BANTUAN LANGSUNG TUNAI (BLT) DANA DESA BULAN DESEMBER (KE-DUA BELAS)
9 TAHUN ANGGARAN 2022
10
11
12
13
14
15 NO NAMA KPM NIK MATA PENCAHARIAN BESARAN BLT DD TANDA TANGAN KET
16 1 SUMARTI 3516067112630011 DAN LAIN-LAIN Rp300.000 1
17 2 BUARI 3516063112620088 DAN LAIN-LAIN Rp300.000 2
18 3 RUKAYAH 3516064109510001 BURUH TANI Rp300.000 3
19 4 GIMO 3516060705590001 DAN LAIN-LAIN Rp300.000 4
20 5 MISENI 3516065502530001 DAN LAIN-LAIN Rp300.000 5
21 6 SITI JULAIKAH 3516067112650149 DAN LAIN-LAIN Rp300.000 6
22 7 SAUDI 3516061008410001 BURUH TANI Rp300.000 7
23 8 NUR DIANA 3516067011770001 DAN LAIN-LAIN Rp300.000 8
24 9 PARIAMI 3516066810610001 DAN LAIN-LAIN Rp300.000 9
25 10 SATUMI 3516064507700001 DAN LAIN-LAIN Rp300.000 10
26 11 FEBRI DWI SETIAWAN 3516062602940003 BURUH TANI Rp300.000 11
27 12 SUWAIYO 3516060112540001 BURUH TANI Rp300.000 12
28 13 SATUNI 3516064607720001 DAN LAIN-LAIN Rp300.000 13
29 14 RUPIAH 3516064804590001 PETANI Rp300.000 14
30 15 SAMPINI 3516064208500001 DAN LAIN-LAIN Rp300.000 15
31 16 NUR HAYATI 3516066702590001 DAN LAIN-LAIN Rp300.000 16
32 17 SUGENG DWI PURNOMO 3516060902820001 DAN LAIN-LAIN Rp300.000 17
33 18 SATUNI 3516064111560001 DAN LAIN-LAIN Rp300.000 18
34 19 SUKARDI 3516062105690002 BURUH TANI Rp300.000 19
35 20 KASIMPEN 3516065107450001 DAN LAIN-LAIN Rp300.000 20
36 21 JUMADI 3516060202680005 DAN LAIN-LAIN Rp300.000 21
37 22 SARDI 3516060107420002 DAN LAIN-LAIN Rp300.000 22
38 23 KASIMAH 3516067112440008 BURUH TANI Rp300.000 23
39 24 MUH CAHYARUM 3516066303580001 DAN LAIN-LAIN Rp300.000 24
40 25 MUTMAINAH 3516064502580002 BURUH TANI Rp300.000 25
41 26 NONO SUYATNO 3516060407610001 DAN LAIN-LAIN Rp300.000 26
42 27 QIMATUL NANDA INSANI 3516066402030001 DAN LAIN-LAIN Rp300.000 27
43 28 SUMANTRI 3516060101510001 DAN LAIN-LAIN Rp300.000 28
44 29 SUNARIYAM 3516065009630002 BURUH TANI Rp300.000 29
45 30 SULIATI 3516064105680002 DAN LAIN-LAIN Rp300.000 30
46 31 LUKMAN 3516060208640001 DAN LAIN-LAIN Rp300.000 31
47 32 KARMAN 3516060208420001 BURUH TANI Rp300.000 32
48 33 REBIN 3516063112450051 BURUH TANI Rp300.000 33
49 34 NGATIMAH 3516065507460001 BURUH TANI Rp300.000 34
50 35 MUK'ATI 3516067112530041 BURUH TANI Rp300.000 35
51 36 SENIMAH 3516067112580050 BURUH TANI Rp300.000 36
52 37 KASIANI 3516064907630003 DAN LAIN-LAIN Rp300.000 37
53 38 BUNAH 3516067112500057 DAN LAIN-LAIN Rp300.000 38
54 39 FIKI OKTA PAMBUDI 3516060510860002 BURUH TANI Rp300.000 39
55 40 YATI 3516067012670001 DAN LAIN-LAIN Rp300.000 40
56 41 SULIKAH 3516064109600022 DAN LAIN-LAIN Rp300.000 41
57 42 SUYANTO 3516063112610018 BURUH TANI Rp300.000 42
58 43 SATIYAH 3516064107570003 DAN LAIN-LAIN Rp300.000 43
59 44 SARMAN 3516063112560041 BURUH TANI Rp300.000 44
60 45 KASMINI 3516067112420120 BURUH TANI Rp300.000 45
61 46 MISNI 3516067112710027 DAN LAIN-LAIN Rp300.000 46
62 47 MISNI 3516067112600070 BURUH TANI Rp300.000 47
63 48 SUMIYATI 3516065005590003 DAN LAIN-LAIN Rp300.000 48
64 49 MUKLISAH 3516066103630001 DAN LAIN-LAIN Rp300.000 49
65 50 WIJI UTAMI 3516066811770001 DAN LAIN-LAIN Rp300.000 50
66 51 TONDO 3516060403610001 DAN LAIN-LAIN Rp300.000 51
67 52 NARIOTO 3516062406740001 BURUH TANI Rp300.000 52
68 53 SUTATIK 3516064210740002 BURUH TANI Rp300.000 53
69 54 LEGINI 3516064508540001 BURUH TANI Rp300.000 54
70 55 SATUNING 3516067112630020 DAN LAIN-LAIN Rp300.000 55
71 56 SARTI 3516067006560001 BURUH TANI Rp300.000 56
72 57 LASERI 3516060510640001 DAN LAIN-LAIN Rp300.000 57
73 58 BUSAR 3513140103770004 BURUH TANI Rp300.000 58
74 59 JAMIL 3516061506630005 BURUH TANI Rp300.000 59
75 60 SUMINI 3516065606610003 BURUH TANI Rp300.000 60
76 61 NAIM 3516060109500006 BURUH TANI Rp300.000 61
77 62 SISWANTO 3516060810740006 BURUH TANI Rp300.000 62
78 63 SIYAM 3516065507650001 DAN LAIN-LAIN Rp300.000 63
79 64 WANIYAH 3516067112650021 DAN LAIN-LAIN Rp300.000 64
80 65 NURALIM 3516061308610002 DAN LAIN-LAIN Rp300.000 65
81 66 BUALI 3516060306650001 BURUH TANI Rp300.000 66
82 67 INDAHWATI 3516114406880009 BURUH TANI Rp300.000 67
83 68 MOCH KUSEN 3516062804640001 DAN LAIN-LAIN Rp300.000 68
84 69 MUCHAIJANAH 3516064901550001 DAN LAIN-LAIN Rp300.000 69
85 70 MUHAMMAD SALIM 3516062707800004 BURUH PABRIK Rp300.000 70
86 71 MUSLIMIN 3516061006800001 DAN LAIN-LAIN Rp300.000 71
87 72 MUKSIN 3516061206280003 BURUH TANI Rp300.000 72
88 73 MOH. DENDI. H 3516062701000001 DAN LAIN-LAIN Rp300.000 73
89 74 PONITI 3516067112520015 BURUH TANI Rp300.000 74
90 75 AHMAD DANU JULIYANTO 3516062007080001 DAN LAIN-LAIN Rp300.000 75
91 76 AHMAD WIRAI 3516061911730001 BURUH TANI Rp300.000 76
92 77 NING MIASRI 3516064209750001 DAN LAIN-LAIN Rp300.000 77
93 78 MUTASLIMAH 3516067112530010 DAN LAIN-LAIN Rp300.000 78
94 79 MISERI 3516061404580001 BURUH TANI Rp300.000 79
95 80 IFA WAHYUNI 3516064506830004 BURUH TANI Rp300.000 80
96 81 MESNAN 3516060912700003 DAN LAIN-LAIN Rp300.000 81
97 82 NGATEMI 3516067112430029 DAN LAIN-LAIN Rp300.000 82
98 83 MUKHAYAH 3516065603590001 DAN LAIN-LAIN Rp300.000 83
99 84 TUNI 3516067112300120 DAN LAIN-LAIN Rp300.000 84
100 85 DAUAMAH 3516065008340002 BURUH TANI Rp300.000 85
101 86 GINI 3516064107600003 DAN LAIN-LAIN Rp300.000 86
102 87 SRIATUN 3516064106650001 DAN LAIN-LAIN Rp300.000 87
103 88 WAGINTEN 3516067112500065 DAN LAIN-LAIN Rp300.000 88
104 89 SUMIATI 3516067112650147 DAN LAIN-LAIN Rp300.000 89
105 90 KARTI 3516067112510040 BURUH TANI Rp300.000 90
106 91 SULAIKAH 3516067112520043 BURUH TANI Rp300.000 91
107 92 UMIYAH 3516067112650126 DAN LAIN-LAIN Rp300.000 92
108 93 LUKIYAH 3516065804740003 BURUH TANI Rp300.000 93
109 94 SUMARI 3516063112580048 BURUH TANI Rp300.000 94
110 95 SUKARMAN 3516060101560005 DAN LAIN-LAIN Rp300.000 95
111 96 KAYATI 3516064101540002 DAN LAIN-LAIN Rp300.000 96
112 97 SUTAJI 3516060303600001 DAN LAIN-LAIN Rp300.000 97
113 98 JUMANI 3516064506580001 BURUH TANI Rp300.000 98
114 99 KANTI 3516065302710003 DAN LAIN-LAIN Rp300.000 99
115 100 JUMANING 3516064510660001 DAN LAIN-LAIN Rp300.000 100
116 101 MARPU'AH 3516065503650005 BURUH TANI Rp300.000 101
117
118 REKAP MATA PENCAHARIAN MOJOKERTO, DESEMBER 2022
119 1 PETANI dan BURUH TANI = 42 Orang KEPALA DESA PUNGGING
120 2 PEDAGANG dan UMKM = 0 Orang
121 3 NELAYAN dan BURUH NELAYAN = 0 Orang
122 4 BURUH PABRIK = 1 Orang
123 5 GURU = 0 Orang P A I M A N
124 6 DAN DAN LAIN-LAIN = 58 Orang
125 JUMLAH = 101 Orang
126
127
128
129
130
131

59
README.md Normal file
View File

@ -0,0 +1,59 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Redberry](https://redberry.international/laravel-development)**
- **[Active Logic](https://activelogic.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@ -0,0 +1,111 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\HasilSaw;
use App\Models\PeriodeSeleksi;
use App\Models\Wilayah;
use Illuminate\Http\Request;
class GisController extends Controller
{
public function index(Request $request)
{
$periodeList = PeriodeSeleksi::where('status', 'selesai')->latest()->get();
$periodeId = $request->get('periode_id');
$periodeAktif = $periodeId
? PeriodeSeleksi::find($periodeId)
: PeriodeSeleksi::where('status', 'selesai')->latest()->first();
$markers = $this->buildMarkers($periodeAktif ? $periodeAktif->id : null);
$totalPenerima = $markers->sum('jumlah_penerima');
$totalWilayah = $markers->filter(fn($m) => $m['jumlah_penerima'] > 0)->count();
// Statistik per dusun untuk periode ini
$statistikDusun = $markers->groupBy('dusun')->map(function ($items) {
return $items->sum('jumlah_penerima');
})->sortDesc();
return view('admin.gis.index', compact(
'markers', 'totalPenerima', 'totalWilayah',
'periodeList', 'periodeAktif', 'statistikDusun'
));
}
public function data(Request $request)
{
$periodeId = $request->get('periode_id');
$markers = $this->buildMarkers($periodeId ?: null);
$totalPenerima = $markers->sum('jumlah_penerima');
$totalWilayah = $markers->filter(fn($m) => $m['jumlah_penerima'] > 0)->count();
// Ambil nama warga penerima per wilayah (untuk popup detail)
$wargaPerWilayah = [];
if ($periodeId) {
$penerima = HasilSaw::where('periode_id', $periodeId)
->where('status', 'penerima')
->with('warga.wilayah')
->orderBy('ranking')
->get();
foreach ($penerima as $h) {
if ($h->warga && $h->warga->wilayah) {
$key = $h->warga->wilayah->dusun . '_' . $h->warga->wilayah->rw;
$wargaPerWilayah[$key][] = [
'nama' => $h->warga->nama,
'ranking' => $h->ranking,
'skor' => number_format($h->skor_akhir, 4),
];
}
}
}
return response()->json([
'markers' => $markers->values(),
'totalPenerima' => $totalPenerima,
'totalWilayah' => $totalWilayah,
'wargaPerWilayah'=> $wargaPerWilayah,
]);
}
private function buildMarkers(?int $periodeId)
{
$wilayah = Wilayah::with('warga')->get();
$query = HasilSaw::where('status', 'penerima');
if ($periodeId) {
$query->where('periode_id', $periodeId);
}
$hasilPenerima = $query->get()->groupBy('warga_id');
return $wilayah->map(function ($w) use ($hasilPenerima) {
$jumlahPenerima = 0;
$totalSkor = 0;
$count = 0;
foreach ($w->warga as $warga) {
if (isset($hasilPenerima[$warga->id])) {
foreach ($hasilPenerima[$warga->id] as $hasil) {
$jumlahPenerima++;
$totalSkor += $hasil->skor_akhir;
$count++;
}
}
}
return [
'dusun' => $w->dusun,
'rw' => $w->rw,
'latitude' => (float) $w->latitude,
'longitude' => (float) $w->longitude,
'jumlah_penerima' => $jumlahPenerima,
'avg_skor' => $count > 0 ? round($totalSkor / $count, 4) : 0,
'label' => "Dusun {$w->dusun} / RW {$w->rw}",
'key' => $w->dusun . '_' . $w->rw,
];
})->filter(fn($m) => $m['latitude'] !== 0.0 && $m['longitude'] !== 0.0);
}
}

View File

@ -0,0 +1,209 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Kriteria;
use App\Models\PeriodeSeleksi;
use Illuminate\Http\Request;
class KriteriaController extends Controller
{
/**
* Tampilkan daftar kriteria
*/
public function index()
{
$kriteria = Kriteria::orderBy('kode')->get();
$totalBobot = $kriteria->sum('bobot');
$isLocked = PeriodeSeleksi::where('status', 'aktif')->exists();
return view('admin.kriteria.index', compact('kriteria', 'totalBobot', 'isLocked'));
}
/**
* Form tambah kriteria baru
*/
public function create()
{
if (PeriodeSeleksi::where('status', 'aktif')->exists()) {
return redirect()->route('admin.kriteria.index')
->with('error', 'Aksi ditolak: Struktur kriteria dikunci karena terdapat periode seleksi yang sedang AKTIF.');
}
$kriteria = Kriteria::orderBy('kode')->get();
$lastKriteria = Kriteria::orderBy('id', 'desc')->first();
$nextCode = 'C1';
if ($lastKriteria) {
$num = (int) filter_var($lastKriteria->kode, FILTER_SANITIZE_NUMBER_INT);
$nextCode = 'C' . ($num + 1);
}
return view('admin.kriteria.create', compact('kriteria', 'nextCode'));
}
/**
* Simpan kriteria baru
*/
public function store(Request $request)
{
if (PeriodeSeleksi::where('status', 'aktif')->exists()) {
return redirect()->route('admin.kriteria.index')
->with('error', 'Aksi ditolak: Struktur kriteria dikunci karena terdapat periode seleksi yang sedang AKTIF.');
}
$validated = $request->validate([
'kode' => 'required|string|max:50|unique:kriteria,kode',
'nama' => 'required|string|max:255',
'jenis' => 'required|in:benefit,cost',
'bobot' => 'required|numeric|min:0|max:1',
'existing_bobot' => 'nullable|array',
'existing_bobot.*' => 'required|numeric|min:0|max:1',
'sub_keterangan' => 'required|array|size:5',
'sub_keterangan.*' => 'required|string|max:255',
], [
'kode.required' => 'Kode kriteria harus diisi',
'kode.unique' => 'Kode kriteria sudah digunakan',
'nama.required' => 'Nama kriteria harus diisi',
'jenis.required' => 'Jenis kriteria harus dipilih',
'bobot.required' => 'Bobot harus diisi',
'bobot.min' => 'Bobot minimal 0',
'bobot.max' => 'Bobot maksimal 1',
'sub_keterangan.*.required' => 'Keterangan sub-kriteria harus diisi',
]);
$newBobot = (float)$validated['bobot'];
$existingBobotSum = 0;
if (isset($validated['existing_bobot'])) {
foreach ($validated['existing_bobot'] as $id => $val) {
$existingBobotSum += (float)$val;
}
}
$totalBobot = $newBobot + $existingBobotSum;
if (abs($totalBobot - 1.00) > 0.001) {
return back()
->withInput()
->with('error', 'Tidak dapat menyimpan kriteria karena total bobot tidak boleh kurang/lebih dari 1.00 (100%). Total saat ini adalah ' . number_format($totalBobot, 2) . '.');
}
\Illuminate\Support\Facades\DB::transaction(function() use ($validated) {
if (isset($validated['existing_bobot'])) {
foreach ($validated['existing_bobot'] as $id => $val) {
Kriteria::where('id', $id)->update(['bobot' => $val]);
}
}
$k = Kriteria::create([
'kode' => strtoupper($validated['kode']),
'nama' => $validated['nama'],
'jenis' => $validated['jenis'],
'bobot' => $validated['bobot'],
]);
foreach ($validated['sub_keterangan'] as $nilai => $keterangan) {
\App\Models\SubKriteria::create([
'kriteria_id' => $k->id,
'nilai' => $nilai,
'keterangan' => $keterangan,
]);
}
});
return redirect()->route('admin.kriteria.index')
->with('success', 'Kriteria baru berhasil ditambahkan dan bobot disesuaikan!');
}
/**
* Form edit kriteria
*/
public function edit(Kriteria $kriterium)
{
if (PeriodeSeleksi::where('status', 'aktif')->exists()) {
return redirect()->route('admin.kriteria.index')
->with('error', 'Aksi ditolak: Struktur kriteria dikunci karena terdapat periode seleksi yang sedang AKTIF.');
}
return view('admin.kriteria.edit', ['kriteria' => $kriterium]);
}
/**
* Update kriteria
*/
public function update(Request $request, Kriteria $kriterium)
{
if (PeriodeSeleksi::where('status', 'aktif')->exists()) {
return redirect()->route('admin.kriteria.index')
->with('error', 'Aksi ditolak: Struktur kriteria dikunci karena terdapat periode seleksi yang sedang AKTIF.');
}
$validated = $request->validate([
'nama' => 'required|string|max:255',
'jenis' => 'required|in:benefit,cost',
'bobot' => 'required|numeric|min:0|max:1',
'sub_keterangan' => 'required|array|size:5',
'sub_keterangan.*' => 'required|string|max:255',
], [
'nama.required' => 'Nama kriteria harus diisi',
'jenis.required' => 'Jenis atribut harus dipilih',
'bobot.required' => 'Bobot harus diisi',
'bobot.min' => 'Bobot minimal 0',
'bobot.max' => 'Bobot maksimal 1',
'sub_keterangan.*.required' => 'Keterangan sub-kriteria harus diisi',
]);
\Illuminate\Support\Facades\DB::transaction(function() use ($kriterium, $validated) {
$kriterium->update([
'nama' => $validated['nama'],
'jenis' => $validated['jenis'],
'bobot' => $validated['bobot'],
]);
foreach ($validated['sub_keterangan'] as $nilai => $keterangan) {
\App\Models\SubKriteria::updateOrCreate(
[
'kriteria_id' => $kriterium->id,
'nilai' => $nilai,
],
[
'keterangan' => $keterangan,
]
);
}
});
$totalBobot = Kriteria::sum('bobot');
if (abs($totalBobot - 1.00) > 0.001) {
return redirect()->route('admin.kriteria.index')
->with('success', 'Kriteria berhasil diperbarui!')
->with('warning', 'Perhatian: Total bobot kriteria saat ini adalah ' . number_format($totalBobot, 2) . '. Silakan sesuaikan bobot seluruh kriteria agar bernilai tepat 1.00 sebelum menghitung SAW.');
}
return redirect()->route('admin.kriteria.index')
->with('success', 'Kriteria berhasil diperbarui!');
}
/**
* Hapus kriteria
*/
public function destroy(Kriteria $kriterium)
{
if (PeriodeSeleksi::where('status', 'aktif')->exists()) {
return redirect()->route('admin.kriteria.index')
->with('error', 'Aksi ditolak: Struktur kriteria dikunci karena terdapat periode seleksi yang sedang AKTIF.');
}
$kriterium->delete();
$totalBobot = Kriteria::sum('bobot');
if (abs($totalBobot - 1.00) > 0.001) {
return redirect()->route('admin.kriteria.index')
->with('success', 'Kriteria berhasil dihapus!')
->with('warning', 'Perhatian: Total bobot kriteria saat ini adalah ' . number_format($totalBobot, 2) . '. Silakan sesuaikan bobot kriteria yang tersisa agar bernilai tepat 1.00 sebelum menghitung SAW.');
}
return redirect()->route('admin.kriteria.index')
->with('success', 'Kriteria berhasil dihapus!');
}
}

View File

@ -0,0 +1,278 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\PenilaianWarga;
use App\Models\Warga;
use App\Models\PeriodeSeleksi;
use App\Models\Kriteria;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Exports\PenilaianWargaExport;
use App\Imports\PenilaianWargaImport;
use Maatwebsite\Excel\Facades\Excel;
class PenilaianWargaController extends Controller
{
public function export($periode_id)
{
$periode = PeriodeSeleksi::findOrFail($periode_id);
$hasData = PenilaianWarga::where('periode_id', $periode_id)->exists();
if (!$hasData) {
return back()->with('error', 'Gagal: Belum ada data penilaian warga yang diinput pada periode ' . $periode->nama . '.');
}
return Excel::download(new PenilaianWargaExport($periode_id), 'Penilaian-Warga-'.$periode->nama.'.xlsx');
}
public function import(Request $request)
{
$request->validate([
'file' => 'required|mimes:xlsx,xls|max:5120',
], [
'file.required' => 'File Excel harus diunggah.',
'file.mimes' => 'File harus berformat .xlsx atau .xls.',
'file.max' => 'Ukuran file maksimal 5MB.',
]);
$periodeAktif = PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periodeAktif) {
return back()->with('error', 'Gagal: Tidak ada periode aktif. Silakan buat periode terlebih dahulu.');
}
try {
Excel::import(new PenilaianWargaImport($periodeAktif->id), $request->file('file'));
return redirect()->route('admin.penilaian.index')
->with('success', 'Data penilaian berhasil diimpor dari file Excel.');
} catch (\Exception $e) {
return back()->with('error', 'Gagal mengimpor data: ' . $e->getMessage());
}
}
public function index()
{
// Ambil periode aktif
$periodeAktif = PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periodeAktif) {
return redirect()->route('admin.periode.index')
->with('warning', 'Tidak ada periode aktif. Silakan buat periode terlebih dahulu.');
}
// Ambil data warga yang sudah dinilai di periode aktif
$wargaDinilai = DB::table('penilaian_warga')
->select('warga_id')
->where('periode_id', $periodeAktif->id)
->distinct()
->get()
->pluck('warga_id');
// Gunakan relasi 'penilaian' sesuai dengan yang ada di Model Warga
$warga = Warga::with(['wilayah', 'penilaian' => function ($q) use ($periodeAktif) {
$q->where('periode_id', $periodeAktif->id);
}])
->whereIn('id', $wargaDinilai)
->orderBy('nama')
->get();
return view('admin.penilaian.index', compact('warga', 'periodeAktif'));
}
public function create()
{
$warga = Warga::where('is_aktif', true)
->with('wilayah')
->orderBy('nama')
->get();
$periodeAktif = PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periodeAktif) {
return redirect()->route('admin.periode.index')
->with('warning', 'Tidak ada periode aktif. Silakan buat periode terlebih dahulu.');
}
$kriteria = Kriteria::with('subKriteria')->orderBy('kode')->get();
return view('admin.penilaian.create', compact('warga', 'periodeAktif', 'kriteria'));
}
public function store(Request $request)
{
$request->validate([
'warga_id' => 'required|exists:warga,id',
'periode_id' => 'required|exists:periode_seleksi,id',
'nilai.*' => 'required|integer|min:1|max:5',
], [
'warga_id.required' => 'Warga harus dipilih',
'periode_id.required' => 'Periode harus dipilih',
'nilai.*.required' => 'Semua kriteria harus diisi',
'nilai.*.integer' => 'Nilai harus berupa angka',
'nilai.*.min' => 'Nilai minimal 1',
'nilai.*.max' => 'Nilai maksimal 5',
]);
// Cek apakah warga sudah dinilai di periode ini
$exists = PenilaianWarga::where('warga_id', $request->warga_id)
->where('periode_id', $request->periode_id)
->exists();
if ($exists) {
return back()->with('error', 'Warga ini sudah dinilai pada periode tersebut.')
->withInput();
}
DB::beginTransaction();
try {
// Simpan penilaian untuk setiap kriteria
$kriteria = Kriteria::orderBy('kode')->get();
foreach ($kriteria as $k) {
if (isset($request->nilai[$k->id])) {
PenilaianWarga::create([
'warga_id' => $request->warga_id,
'periode_id' => $request->periode_id,
'kriteria_id' => $k->id,
'nilai' => $request->nilai[$k->id],
]);
}
}
DB::commit();
return redirect()->route('admin.penilaian.index')
->with('success', 'Penilaian berhasil disimpan.');
} catch (\Exception $e) {
DB::rollBack();
return back()->with('error', 'Terjadi kesalahan: ' . $e->getMessage())
->withInput();
}
}
public function show(Request $request, $id)
{
$periodeId = $request->get('periode_id');
$periodeAktif = $periodeId
? PeriodeSeleksi::find($periodeId)
: PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periodeAktif) {
return redirect()->route('admin.periode.index')
->with('warning', 'Tidak ada periode aktif atau periode yang dipilih.');
}
$warga = Warga::with('wilayah')->findOrFail($id);
// Gunakan relasi 'penilaian' dengan eager load kriteria
$penilaian = PenilaianWarga::with('kriteria')
->where('warga_id', $id)
->where('periode_id', $periodeAktif->id)
->get();
$kriteria = Kriteria::with('subKriteria')->orderBy('kode')->get();
return view('admin.penilaian.show', compact('warga', 'penilaian', 'periodeAktif', 'kriteria'));
}
public function edit(Request $request, $id)
{
$periodeId = $request->get('periode_id');
$periodeAktif = $periodeId
? PeriodeSeleksi::find($periodeId)
: PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periodeAktif) {
return redirect()->route('admin.periode.index')
->with('warning', 'Tidak ada periode aktif atau periode yang dipilih.');
}
$warga = Warga::with('wilayah')->findOrFail($id);
$penilaian = PenilaianWarga::where('warga_id', $id)
->where('periode_id', $periodeAktif->id)
->get()
->keyBy('kriteria_id');
$kriteria = Kriteria::with('subKriteria')->orderBy('kode')->get();
return view('admin.penilaian.edit', compact('warga', 'penilaian', 'periodeAktif', 'kriteria'));
}
public function update(Request $request, $id)
{
$request->validate([
'nilai.*' => 'required|integer|min:1|max:5',
'periode_id' => 'required|exists:periode_seleksi,id',
], [
'nilai.*.required' => 'Semua kriteria harus diisi',
'nilai.*.integer' => 'Nilai harus berupa angka',
'nilai.*.min' => 'Nilai minimal 1',
'nilai.*.max' => 'Nilai maksimal 5',
]);
// ✅ BUG #6 FIX: Gunakan periode_id dari form, bukan periodeAktif
// Ini mencegah data tersimpan ke periode yang salah
$periodeId = $request->periode_id;
DB::beginTransaction();
try {
$kriteria = Kriteria::orderBy('kode')->get();
foreach ($kriteria as $k) {
if (isset($request->nilai[$k->id])) {
PenilaianWarga::updateOrCreate(
[
'warga_id' => $id,
'periode_id' => $periodeId,
'kriteria_id' => $k->id,
],
[
'nilai' => $request->nilai[$k->id],
]
);
}
}
DB::commit();
return redirect()->route('admin.penilaian.index')
->with('success', 'Penilaian berhasil diperbarui.');
} catch (\Exception $e) {
DB::rollBack();
return back()->with('error', 'Terjadi kesalahan: ' . $e->getMessage())
->withInput();
}
}
public function destroy($id)
{
$periodeAktif = PeriodeSeleksi::where('status', 'aktif')->first();
// ✅ BUG #3 FIX: Null-safety — jika tidak ada periode aktif, redirect dengan pesan
if (!$periodeAktif) {
return redirect()->route('admin.periode.index')
->with('warning', 'Tidak ada periode aktif. Tidak dapat menghapus penilaian.');
}
DB::beginTransaction();
try {
PenilaianWarga::where('warga_id', $id)
->where('periode_id', $periodeAktif->id)
->delete();
DB::commit();
return redirect()->route('admin.penilaian.index')
->with('success', 'Penilaian berhasil dihapus.');
} catch (\Exception $e) {
DB::rollBack();
return back()->with('error', 'Terjadi kesalahan: ' . $e->getMessage());
}
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\PenilaianWarga;
use App\Models\Warga;
use App\Models\PeriodeSeleksi;
use App\Models\Kriteria;
use Illuminate\Http\Request;
class PenilaianWargaController extends Controller
{
public function index()
{
$periode = PeriodeSeleksi::where('status', 'aktif')->latest()->get();
return view('admin.penilaian.index', compact('periode'));
}
public function create()
{
$warga = Warga::where('is_aktif', true)->orderBy('nama')->get();
$periode = PeriodeSeleksi::where('status', 'aktif')->latest()->get();
$kriteria = Kriteria::orderBy('kode')->get();
return view('admin.penilaian.create', compact('warga', 'periode', 'kriteria'));
}
public function store(Request $request)
{
$request->validate([
'warga_id' => 'required|exists:warga,id',
'periode_id' => 'required|exists:periode_seleksi,id',
'c1' => 'required|numeric|min:0',
'c2' => 'required|numeric|min:0',
'c3' => 'required|numeric|min:0',
'c4' => 'required|numeric|min:0',
'c5' => 'required|numeric|min:0',
'c6' => 'required|numeric|min:0',
'c7' => 'required|numeric|min:0',
]);
// Cek duplikat
$exists = PenilaianWarga::where('warga_id', $request->warga_id)
->where('periode_id', $request->periode_id)
->exists();
if ($exists) {
return back()->with('error', 'Warga ini sudah dinilai pada periode tersebut.');
}
PenilaianWarga::create($request->all());
return redirect()->route('admin.penilaian.index')
->with('success', 'Penilaian berhasil disimpan.');
}
public function show(PenilaianWarga $penilaian)
{
$penilaian->load('warga', 'periode');
$kriteria = Kriteria::orderBy('kode')->get();
return view('admin.penilaian.show', compact('penilaian', 'kriteria'));
}
public function edit(PenilaianWarga $penilaian)
{
$warga = Warga::where('is_aktif', true)->orderBy('nama')->get();
$periode = PeriodeSeleksi::where('status', 'aktif')->latest()->get();
$kriteria = Kriteria::orderBy('kode')->get();
return view('admin.penilaian.edit', compact('penilaian', 'warga', 'periode', 'kriteria'));
}
public function update(Request $request, PenilaianWarga $penilaian)
{
$request->validate([
'c1' => 'required|numeric|min:0',
'c2' => 'required|numeric|min:0',
'c3' => 'required|numeric|min:0',
'c4' => 'required|numeric|min:0',
'c5' => 'required|numeric|min:0',
'c6' => 'required|numeric|min:0',
'c7' => 'required|numeric|min:0',
]);
$penilaian->update($request->only('c1','c2','c3','c4','c5','c6','c7'));
return redirect()->route('admin.penilaian.index')
->with('success', 'Penilaian berhasil diperbarui.');
}
public function destroy(PenilaianWarga $penilaian)
{
$penilaian->delete();
return redirect()->route('admin.penilaian.index')
->with('success', 'Penilaian berhasil dihapus.');
}
}

View File

@ -0,0 +1,141 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\PeriodeSeleksi;
use Illuminate\Http\Request;
class PeriodeSeleksiController extends Controller
{
public function index()
{
$periode = PeriodeSeleksi::latest()->paginate(10);
return view('admin.periode.index', compact('periode'));
}
public function create()
{
return view('admin.periode.create');
}
public function store(Request $request)
{
$request->validate([
'nama' => 'required|string|max:100|unique:periode_seleksi,nama',
'tanggal_mulai' => 'required|date',
'tanggal_selesai' => [
'required',
'date',
'after_or_equal:tanggal_mulai',
function ($attribute, $value, $fail) {
if (strtotime($value) < strtotime(date('Y-m-d'))) {
$fail('Tanggal selesai tidak boleh di masa lalu (sebelum hari ini).');
}
},
],
'kuota_penerima' => 'required|integer|min:1',
'status' => 'required|in:aktif,selesai,arsip', // ✅ UBAH INI
], [
'nama.required' => 'Nama periode harus diisi',
'nama.unique' => 'Nama periode sudah digunakan atau sudah terdaftar.',
'tanggal_mulai.required' => 'Tanggal mulai harus diisi',
'tanggal_selesai.required' => 'Tanggal selesai harus diisi',
'tanggal_selesai.after_or_equal' => 'Tanggal selesai harus setelah atau sama dengan tanggal mulai',
'kuota_penerima.required' => 'Kuota penerima harus diisi',
'kuota_penerima.min' => 'Kuota penerima minimal 1',
'status.required' => 'Status harus dipilih',
'status.in' => 'Status tidak valid. Pilih: aktif, selesai, atau arsip',
]);
// Validasi Strict Block (Opsi 2): Cegah lebih dari 1 periode aktif
if ($request->status === 'aktif') {
$adaAktif = PeriodeSeleksi::where('status', 'aktif')->exists();
if ($adaAktif) {
return back()->with('error', 'Gagal: Masih ada periode yang berstatus Aktif. Harap selesaikan periode sebelumnya terlebih dahulu agar data tidak bentrok.')->withInput();
}
}
// Auto-generate nama jika kosong
if (empty($request->nama)) {
$bulanIndo = ['Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember'];
$tgl = \Carbon\Carbon::parse($request->tanggal_mulai);
$request->merge(['nama' => 'BLT-DD ' . $bulanIndo[$tgl->month - 1] . ' ' . $tgl->year]);
}
PeriodeSeleksi::create($request->all());
return redirect()->route('admin.periode.index')
->with('success', 'Periode seleksi berhasil ditambahkan.');
}
public function show(PeriodeSeleksi $periode)
{
$jumlahDinilai = $periode->penilaian()->count();
$jumlahPenerima = $periode->hasilSaw()->where('status', 'penerima')->count();
return view('admin.periode.show', compact('periode', 'jumlahDinilai', 'jumlahPenerima'));
}
public function edit(PeriodeSeleksi $periode)
{
if ($periode->status === 'selesai') {
return redirect()->route('admin.periode.index')
->with('error', 'Aksi Ditolak: Periode yang sudah selesai tidak dapat diubah karena datanya sudah bersifat final.');
}
return view('admin.periode.edit', compact('periode'));
}
public function update(Request $request, PeriodeSeleksi $periode)
{
if ($periode->status === 'selesai') {
return redirect()->route('admin.periode.index')
->with('error', 'Aksi Ditolak: Periode yang sudah selesai tidak dapat diperbarui.');
}
$request->validate([
'nama' => 'required|string|max:100|unique:periode_seleksi,nama,' . $periode->id,
'tanggal_mulai' => 'required|date',
'tanggal_selesai' => 'required|date|after_or_equal:tanggal_mulai',
'kuota_penerima' => 'required|integer|min:1',
'status' => 'required|in:aktif,selesai,arsip', // ✅ UBAH INI
], [
'nama.required' => 'Nama periode harus diisi',
'nama.unique' => 'Nama periode sudah digunakan atau sudah terdaftar.',
'tanggal_mulai.required' => 'Tanggal mulai harus diisi',
'tanggal_selesai.required' => 'Tanggal selesai harus diisi',
'tanggal_selesai.after_or_equal' => 'Tanggal selesai harus setelah atau sama dengan tanggal mulai',
'kuota_penerima.required' => 'Kuota penerima harus diisi',
'kuota_penerima.min' => 'Kuota penerima minimal 1',
'status.required' => 'Status harus dipilih',
'status.in' => 'Status tidak valid. Pilih: aktif, selesai, atau arsip',
]);
// Validasi Strict Block (Opsi 2): Cegah lebih dari 1 periode aktif
if ($request->status === 'aktif' && $periode->status !== 'aktif') {
$adaAktif = PeriodeSeleksi::where('status', 'aktif')->where('id', '!=', $periode->id)->exists();
if ($adaAktif) {
return back()->with('error', 'Gagal: Masih ada periode lain yang berstatus Aktif. Harap selesaikan periode tersebut terlebih dahulu.')->withInput();
}
}
// Auto-generate nama jika kosong
if (empty($request->nama)) {
$bulanIndo = ['Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember'];
$tgl = \Carbon\Carbon::parse($request->tanggal_mulai);
$request->merge(['nama' => 'BLT-DD ' . $bulanIndo[$tgl->month - 1] . ' ' . $tgl->year]);
}
$periode->update($request->all());
return redirect()->route('admin.periode.index')
->with('success', 'Periode seleksi berhasil diperbarui.');
}
public function destroy(PeriodeSeleksi $periode)
{
$periode->delete();
return redirect()->route('admin.periode.index')
->with('success', 'Periode seleksi berhasil dihapus.');
}
}

View File

@ -0,0 +1,270 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\PeriodeSeleksi;
use App\Models\Warga;
use App\Models\Kriteria;
use App\Models\PenilaianWarga;
use App\Models\HasilSaw;
use App\Models\DetailNormalisasi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Barryvdh\DomPDF\Facade\Pdf;
class SawController extends Controller
{
public function index($periodeId)
{
$periode = PeriodeSeleksi::findOrFail($periodeId);
$kriteria = Kriteria::orderBy('kode')->get();
$sudahDihitung = HasilSaw::where('periode_id', $periodeId)->exists();
$wargaDinilaiIds = DB::table('penilaian_warga')
->select('warga_id')
->where('periode_id', $periodeId)
->distinct()
->pluck('warga_id');
$wargaDinilai = Warga::with(['penilaian' => function ($q) use ($periodeId) {
$q->where('periode_id', $periodeId)->with('kriteria');
}])
->whereIn('id', $wargaDinilaiIds)
->orderBy('nama')
->get();
return view('admin.saw.index', compact('periode', 'kriteria', 'wargaDinilai', 'sudahDihitung'));
}
public function hitung($periodeId)
{
$periode = PeriodeSeleksi::findOrFail($periodeId);
$kriteria = Kriteria::orderBy('kode')->get();
// ✅ BUG #5 FIX: Blokir hitung ulang jika periode sudah selesai/arsip
if (in_array($periode->status, ['selesai', 'arsip'])) {
return back()->with('error', 'Periode ini sudah ditutup dan tidak bisa dihitung ulang. Buat periode baru untuk seleksi berikutnya.');
}
if ($kriteria->count() === 0) {
return back()->with('error', 'Data kriteria belum ada. Silakan hubungi Superadmin untuk menambahkan kriteria.');
}
// Validasi total bobot kriteria harus tepat 1.00
$totalBobot = Kriteria::sum('bobot');
if (abs($totalBobot - 1.00) > 0.001) {
return back()->with('error', 'Perhitungan SAW tidak dapat dilanjutkan karena total bobot kriteria saat ini adalah ' . number_format($totalBobot, 2) . '. Total bobot harus bernilai tepat 1.00. Silakan hubungi Superadmin untuk menyesuaikan.');
}
$wargaDinilaiIds = DB::table('penilaian_warga')
->select('warga_id')
->where('periode_id', $periodeId)
->distinct()
->pluck('warga_id');
if ($wargaDinilaiIds->isEmpty()) {
return back()->with('error', 'Belum ada data penilaian untuk periode ini.');
}
// ✅ BUG #4 FIX: Pre-fetch semua max/min per kriteria sebelum loop (cegah N+1)
$statPerKriteria = PenilaianWarga::where('periode_id', $periodeId)
->groupBy('kriteria_id')
->selectRaw('kriteria_id, MAX(nilai) as max_val, MIN(nilai) as min_val')
->get()
->keyBy('kriteria_id');
// Hapus hasil sebelumnya
HasilSaw::where('periode_id', $periodeId)->delete();
DB::beginTransaction();
try {
// Pre-fetch semua penilaian untuk periode ini (cegah N+1 per warga)
$semuaPenilaian = PenilaianWarga::where('periode_id', $periodeId)
->get()
->groupBy('warga_id');
foreach ($wargaDinilaiIds as $wargaId) {
$penilaian = isset($semuaPenilaian[$wargaId])
? $semuaPenilaian[$wargaId]->keyBy('kriteria_id')
: collect();
// Skip warga dengan data tidak lengkap
if ($penilaian->count() < $kriteria->count()) {
Log::warning("Warga ID {$wargaId} hanya punya {$penilaian->count()} dari {$kriteria->count()} kriteria. Dilewati.");
continue;
}
$hasilSaw = HasilSaw::create([
'warga_id' => $wargaId,
'periode_id' => $periodeId,
'skor_akhir' => 0,
'ranking' => 0,
'status' => 'tidak_penerima',
]);
$skorTotal = 0;
foreach ($kriteria as $k) {
if (!isset($penilaian[$k->id])) continue;
$nilaiAsli = $penilaian[$k->id]->nilai;
$stat = $statPerKriteria[$k->id] ?? null;
if ($k->jenis === 'benefit') {
$nilaiMax = $stat ? $stat->max_val : 0;
$nilaiNormalisasi = $nilaiMax > 0 ? $nilaiAsli / $nilaiMax : 0;
} else {
$nilaiMin = $stat ? $stat->min_val : 0;
$nilaiNormalisasi = $nilaiAsli > 0 ? $nilaiMin / $nilaiAsli : 0;
}
$nilaiTerbobot = $nilaiNormalisasi * $k->bobot;
$skorTotal += $nilaiTerbobot;
DetailNormalisasi::create([
'hasil_saw_id' => $hasilSaw->id,
'kriteria_id' => $k->id,
'nilai_asli' => $nilaiAsli,
'nilai_normalisasi' => $nilaiNormalisasi,
'nilai_terbobot' => $nilaiTerbobot,
]);
}
$hasilSaw->update(['skor_akhir' => $skorTotal]);
}
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
Log::error('Error hitung SAW: ' . $e->getMessage());
return back()->with('error', 'Terjadi kesalahan saat perhitungan: ' . $e->getMessage());
}
return redirect()->route('admin.saw.hasil', $periode)
->with('success', 'Perhitungan SAW berhasil. Silakan lihat hasil dan tetapkan penerima.');
}
public function hasil($periodeId)
{
$periode = PeriodeSeleksi::findOrFail($periodeId);
$hasilRaw = $this->getHasilWithTieBreaking($periodeId);
// Update ranking
$ranking = 1;
foreach ($hasilRaw as $h) {
HasilSaw::where('id', $h->id)->update(['ranking' => $ranking++]);
}
$hasil = HasilSaw::where('periode_id', $periodeId)
->with(['warga.wilayah', 'detailNormalisasi.kriteria'])
->orderBy('ranking')
->get();
$kriteria = Kriteria::orderBy('kode')->get();
$totalPenerima = HasilSaw::where('periode_id', $periodeId)->where('status', 'penerima')->count();
$totalCadangan = HasilSaw::where('periode_id', $periodeId)->where('status', 'cadangan')->count();
return view('admin.saw.hasil', compact('periode', 'hasil', 'kriteria', 'totalPenerima', 'totalCadangan'));
}
public function tetapkan($periodeId)
{
$periode = PeriodeSeleksi::findOrFail($periodeId);
$hasil = $this->getHasilWithTieBreaking($periodeId);
$kuota = $periode->kuota_penerima;
// ✅ BUG #2 FIX: Baca kuota cadangan dari database, bukan hardcoded
$kuotaCadangan = $periode->kuota_cadangan ?? 5;
$ranking = 1;
foreach ($hasil as $h) {
if ($ranking <= $kuota) {
$status = 'penerima';
} elseif ($ranking <= $kuota + $kuotaCadangan) {
$status = 'cadangan';
} else {
$status = 'tidak_penerima';
}
HasilSaw::where('id', $h->id)->update([
'ranking' => $ranking++,
'status' => $status,
]);
}
$periode->update(['status' => 'selesai']);
return redirect()->route('admin.saw.hasil', $periode)
->with('success', 'Penerima berhasil ditetapkan dengan mekanisme tie-breaking.');
}
/**
* Helper: Ambil hasil SAW dengan tie-breaking
* BUG #1 FIX: Gunakan kode kriteria (C1, C2, C7) bukan hardcoded ID
*/
private function getHasilWithTieBreaking($periodeId)
{
// Ambil ID berdasarkan kode — aman jika DB di-reset
$idC5 = Kriteria::where('kode', 'C5')->value('id') ?? 0;
$idC1 = Kriteria::where('kode', 'C1')->value('id') ?? 0;
$idC2 = Kriteria::where('kode', 'C2')->value('id') ?? 0;
return DB::table('hasil_saw as hs')
->join('warga as w', 'hs.warga_id', '=', 'w.id')
->leftJoin('penilaian_warga as p5', function ($join) use ($periodeId, $idC5) {
$join->on('hs.warga_id', '=', 'p5.warga_id')
->where('p5.periode_id', '=', $periodeId)
->where('p5.kriteria_id', '=', $idC5);
})
->leftJoin('penilaian_warga as p1', function ($join) use ($periodeId, $idC1) {
$join->on('hs.warga_id', '=', 'p1.warga_id')
->where('p1.periode_id', '=', $periodeId)
->where('p1.kriteria_id', '=', $idC1);
})
->leftJoin('penilaian_warga as p2', function ($join) use ($periodeId, $idC2) {
$join->on('hs.warga_id', '=', 'p2.warga_id')
->where('p2.periode_id', '=', $periodeId)
->where('p2.kriteria_id', '=', $idC2);
})
->where('hs.periode_id', $periodeId)
->select('hs.*', 'w.nama', 'w.dusun', 'w.rw',
'p5.nilai as c5_nilai', 'p1.nilai as c1_nilai', 'p2.nilai as c2_nilai')
->orderBy('hs.skor_akhir', 'desc')
->orderByRaw('COALESCE(p5.nilai, 999) ASC')
->orderByRaw('COALESCE(p1.nilai, 999) ASC')
->orderByRaw('COALESCE(p2.nilai, 0) DESC')
->orderBy('hs.created_at', 'asc')
->get();
}
// ✅ BUG #7 FIX: Validasi status periode sebelum export PDF
public function exportPdf($periodeId)
{
$periode = PeriodeSeleksi::findOrFail($periodeId);
if ($periode->status !== 'selesai') {
return back()->with('error', 'Export PDF hanya tersedia setelah periode ditetapkan (status: selesai).');
}
$kriteria = Kriteria::orderBy('kode')->get();
$hasil = HasilSaw::where('periode_id', $periodeId)
->with(['warga.wilayah', 'detailNormalisasi.kriteria'])
->orderBy('ranking')
->get();
$pdf = Pdf::loadView('admin.saw.pdf', compact('periode', 'hasil', 'kriteria'))
->setPaper('a4', 'portrait')
->setOptions([
'defaultFont' => 'DejaVu Sans',
'isRemoteEnabled' => false,
'isHtml5ParserEnabled' => true,
]);
$filename = 'Hasil-SAW-' . str_replace(' ', '-', $periode->nama) . '.pdf';
return $pdf->download($filename);
}
}

View File

@ -0,0 +1,124 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rule;
class UserController extends Controller
{
/**
* Display a listing of the users.
*/
public function index()
{
$users = User::with('roles')->orderBy('id')->get();
return view('admin.users.index', compact('users'));
}
/**
* Show the form for creating a new user.
*/
public function create()
{
$roles = Role::all();
return view('admin.users.create', compact('roles'));
}
/**
* Store a newly created user in storage.
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'role' => 'required|exists:roles,name',
], [
'name.required' => 'Nama lengkap wajib diisi',
'email.required' => 'Email wajib diisi',
'email.unique' => 'Email sudah terdaftar',
'password.required' => 'Password wajib diisi',
'password.min' => 'Password minimal 6 karakter',
'password.confirmed'=> 'Konfirmasi password tidak cocok',
'role.required' => 'Role wajib dipilih',
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
$user->assignRole($request->role);
return redirect()->route('admin.users.index')
->with('success', 'User berhasil ditambahkan!');
}
/**
* Show the form for editing the specified user.
*/
public function edit(User $user)
{
$roles = Role::all();
return view('admin.users.edit', compact('user', 'roles'));
}
/**
* Update the specified user in storage.
*/
public function update(Request $request, User $user)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => ['required', 'string', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
'password' => 'nullable|string|min:6|confirmed',
'role' => 'required|exists:roles,name',
], [
'name.required' => 'Nama lengkap wajib diisi',
'email.required' => 'Email wajib diisi',
'email.unique' => 'Email sudah terdaftar',
'password.min' => 'Password minimal 6 karakter',
'password.confirmed'=> 'Konfirmasi password tidak cocok',
'role.required' => 'Role wajib dipilih',
]);
$user->name = $request->name;
$user->email = $request->email;
if ($request->filled('password')) {
$user->password = Hash::make($request->password);
}
$user->save();
// Sync role baru
$user->syncRoles([$request->role]);
return redirect()->route('admin.users.index')
->with('success', 'Data user berhasil diperbarui!');
}
/**
* Remove the specified user from storage.
*/
public function destroy(User $user)
{
// Cegah menghapus diri sendiri
if (auth()->id() === $user->id) {
return redirect()->route('admin.users.index')
->with('error', 'Anda tidak dapat menghapus akun Anda sendiri yang sedang aktif!');
}
$user->delete();
return redirect()->route('admin.users.index')
->with('success', 'User berhasil dihapus!');
}
}

View File

@ -0,0 +1,138 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Warga;
use App\Models\Wilayah;
use Illuminate\Http\Request;
use App\Exports\WargaExport;
use Maatwebsite\Excel\Facades\Excel;
class WargaController extends Controller
{
public function export()
{
$hasData = Warga::exists();
if (!$hasData) {
return back()->with('error', 'Gagal: Belum ada data warga di database untuk diexport.');
}
return Excel::download(new WargaExport, 'Data-Warga.xlsx');
}
public function index()
{
$warga = Warga::with('wilayah')->latest()->paginate(10);
return view('admin.warga.index', compact('warga'));
}
public function create()
{
$wilayah = Wilayah::orderBy('dusun')->orderBy('rw')->get();
return view('admin.warga.create', compact('wilayah'));
}
public function store(Request $request)
{
$request->validate([
'nik' => 'required|digits:16|unique:warga,nik',
'nama' => 'required|string|max:100',
'alamat' => 'required|string',
'wilayah_id' => 'required|exists:wilayah,id',
'rt' => 'nullable|string|max:5',
'no_telp' => 'nullable|string|max:15',
], [
'nik.required' => 'NIK wajib diisi.',
'nik.digits' => 'NIK harus berupa angka dengan panjang tepat 16 digit.',
'nik.unique' => 'NIK sudah terdaftar di sistem.',
'nama.required' => 'Nama lengkap wajib diisi.',
'nama.string' => 'Nama lengkap harus berupa teks.',
'nama.max' => 'Nama lengkap maksimal 100 karakter.',
'alamat.required' => 'Alamat wajib diisi.',
'wilayah_id.required' => 'Wilayah wajib dipilih.',
'wilayah_id.exists' => 'Wilayah yang dipilih tidak valid.',
]);
// Ambil koordinat & info dari wilayah yang dipilih
$wilayah = Wilayah::findOrFail($request->wilayah_id);
Warga::create([
'nik' => $request->nik,
'nama' => $request->nama,
'alamat' => $request->alamat,
'wilayah_id' => $wilayah->id,
'dusun' => $wilayah->dusun,
'rw' => $wilayah->rw,
'rt' => $request->rt,
'no_telp' => $request->no_telp,
'latitude' => $wilayah->latitude,
'longitude' => $wilayah->longitude,
// ✅ FIX: Warga baru SELALU aktif (tidak ada checkbox di form create)
'is_aktif' => true,
]);
return redirect()->route('admin.warga.index')
->with('success', 'Data warga berhasil ditambahkan.');
}
public function show(Warga $warga)
{
return view('admin.warga.show', compact('warga'));
}
public function edit(Warga $warga)
{
$wilayah = Wilayah::orderBy('dusun')->orderBy('rw')->get();
return view('admin.warga.edit', compact('warga', 'wilayah'));
}
public function update(Request $request, Warga $warga)
{
$request->validate([
'nik' => 'required|digits:16|unique:warga,nik,' . $warga->id,
'nama' => 'required|string|max:100',
'alamat' => 'required|string',
'wilayah_id' => 'required|exists:wilayah,id',
'rt' => 'nullable|string|max:5',
'no_telp' => 'nullable|string|max:15',
], [
'nik.required' => 'NIK wajib diisi.',
'nik.digits' => 'NIK harus berupa angka dengan panjang tepat 16 digit.',
'nik.unique' => 'NIK sudah terdaftar di sistem.',
'nama.required' => 'Nama lengkap wajib diisi.',
'nama.string' => 'Nama lengkap harus berupa teks.',
'nama.max' => 'Nama lengkap maksimal 100 karakter.',
'alamat.required' => 'Alamat wajib diisi.',
'wilayah_id.required' => 'Wilayah wajib dipilih.',
'wilayah_id.exists' => 'Wilayah yang dipilih tidak valid.',
]);
$wilayah = Wilayah::findOrFail($request->wilayah_id);
$warga->update([
'nik' => $request->nik,
'nama' => $request->nama,
'alamat' => $request->alamat,
'wilayah_id' => $wilayah->id,
'dusun' => $wilayah->dusun,
'rw' => $wilayah->rw,
'rt' => $request->rt,
'no_telp' => $request->no_telp,
'latitude' => $wilayah->latitude,
'longitude' => $wilayah->longitude,
// ✅ FIX BUG: Checkbox tidak tercentang = null, bukan false
// Gunakan has() untuk cek apakah checkbox ada di request
'is_aktif' => $request->has('is_aktif') ? true : false,
]);
return redirect()->route('admin.warga.index')
->with('success', 'Data warga berhasil diperbarui.');
}
public function destroy(Warga $warga)
{
$warga->delete();
return redirect()->route('admin.warga.index')
->with('success', 'Data warga berhasil dihapus.');
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*/
public function create(): View
{
return view('auth.login');
}
/**
* Handle an incoming authentication request.
*/
public function store(LoginRequest $request): RedirectResponse
{
$request->authenticate();
$request->session()->regenerate();
$user = auth()->user();
if ($user->hasRole('superadmin') || $user->hasRole('admin') || $user->hasRole('user')) {
return redirect()->intended(route('admin.dashboard'));
}
return redirect()->intended(route('publik.index'));
}
/**
* Destroy an authenticated session.
*/
public function destroy(Request $request): RedirectResponse
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*/
public function show(): View
{
return view('auth.confirm-password');
}
/**
* Confirm the user's password.
*/
public function store(Request $request): RedirectResponse
{
if (! Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}
$request->session()->put('auth.password_confirmed_at', time());
return redirect()->intended(route('dashboard', absolute: false));
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*/
public function store(Request $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false));
}
$request->user()->sendEmailVerificationNotification();
return back()->with('status', 'verification-link-sent');
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class EmailVerificationPromptController extends Controller
{
/**
* Display the email verification prompt.
*/
public function __invoke(Request $request): RedirectResponse|View
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(route('dashboard', absolute: false))
: view('auth.verify-email');
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
class NewPasswordController extends Controller
{
/**
* Display the password reset view.
*/
public function create(Request $request): View
{
return view('auth.reset-password', ['request' => $request]);
}
/**
* Handle an incoming new password request.
*
* @throws ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'token' => ['required'],
'email' => ['required', 'email'],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function (User $user) use ($request) {
$user->forceFill([
'password' => Hash::make($request->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;
class PasswordController extends Controller
{
/**
* Update the user's password.
*/
public function update(Request $request): RedirectResponse
{
$validated = $request->validateWithBag('updatePassword', [
'current_password' => ['required', 'current_password'],
'password' => ['required', Password::defaults(), 'confirmed'],
]);
$request->user()->update([
'password' => Hash::make($validated['password']),
]);
return back()->with('status', 'password-updated');
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
*/
public function create(): View
{
return view('auth.forgot-password');
}
/**
* Handle an incoming password reset link request.
*
* @throws ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'email' => ['required', 'email'],
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$request->only('email')
);
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
class RegisteredUserController extends Controller
{
/**
* Display the registration view.
*/
public function create(): View
{
return view('auth.register');
}
/**
* Handle an incoming registration request.
*
* @throws ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
event(new Registered($user));
Auth::login($user);
return redirect(route('dashboard', absolute: false));
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\RedirectResponse;
class VerifyEmailController extends Controller
{
/**
* Mark the authenticated user's email address as verified.
*/
public function __invoke(EmailVerificationRequest $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\ProfileUpdateRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\View\View;
class ProfileController extends Controller
{
/**
* Display the user's profile form.
*/
public function edit(Request $request): View
{
return view('profile.edit', [
'user' => $request->user(),
]);
}
/**
* Update the user's profile information.
*/
public function update(ProfileUpdateRequest $request): RedirectResponse
{
$request->user()->fill($request->validated());
if ($request->user()->isDirty('email')) {
$request->user()->email_verified_at = null;
}
$request->user()->save();
return Redirect::route('profile.edit')->with('status', 'profile-updated');
}
/**
* Delete the user's account.
*/
public function destroy(Request $request): RedirectResponse
{
$request->validateWithBag('userDeletion', [
'password' => ['required', 'current_password'],
]);
$user = $request->user();
Auth::logout();
$user->delete();
$request->session()->invalidate();
$request->session()->regenerateToken();
return Redirect::to('/');
}
}

View File

@ -0,0 +1,127 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\HasilSaw;
use App\Models\PeriodeSeleksi;
use App\Models\Warga;
use App\Models\Wilayah;
use Illuminate\Http\Request;
class PublikController extends Controller
{
public function index()
{
$periodeAktif = PeriodeSeleksi::where('status', 'aktif')->latest()->first();
$periodeSelesai = PeriodeSeleksi::where('status', 'selesai')->count();
$totalPenerima = HasilSaw::where('status', 'penerima')->distinct('warga_id')->count('warga_id');
$totalWarga = \App\Models\Warga::count();
$periodeList = PeriodeSeleksi::latest()->take(3)->get();
return view('publik.index', compact(
'periodeAktif',
'periodeSelesai',
'totalPenerima',
'totalWarga',
'periodeList'
));
}
public function penerima(Request $request)
{
$periodeId = $request->get('periode_id');
$periodeList = PeriodeSeleksi::where('status', 'selesai')->latest()->get();
$periode = $periodeId
? PeriodeSeleksi::find($periodeId)
: PeriodeSeleksi::where('status', 'selesai')->latest()->first();
$hasil = collect();
if ($periode) {
$hasil = HasilSaw::where('periode_id', $periode->id)
->where('status', 'penerima')
->with('warga.wilayah')
->orderBy('ranking')
->get();
}
return view('publik.penerima', compact('periode', 'periodeList', 'hasil'));
}
public function peta(Request $request)
{
$periodeList = PeriodeSeleksi::where('status', 'selesai')->latest()->get();
$periodeId = $request->get('periode_id');
// Default: periode selesai terbaru
$periodeAktif = $periodeId
? PeriodeSeleksi::find($periodeId)
: PeriodeSeleksi::where('status', 'selesai')->latest()->first();
$markers = $this->buildMarkers($periodeAktif ? $periodeAktif->id : null);
$totalPenerima = $markers->sum('jumlah_penerima');
$totalWilayah = $markers->filter(fn($m) => $m['jumlah_penerima'] > 0)->count();
return view('publik.peta', compact(
'markers', 'totalPenerima', 'totalWilayah',
'periodeList', 'periodeAktif'
));
}
// ── AJAX endpoint: return JSON markers per periode ──
public function petaData(Request $request)
{
$periodeId = $request->get('periode_id');
$markers = $this->buildMarkers($periodeId);
$totalPenerima = $markers->sum('jumlah_penerima');
$totalWilayah = $markers->filter(fn($m) => $m['jumlah_penerima'] > 0)->count();
return response()->json([
'markers' => $markers->values(),
'totalPenerima' => $totalPenerima,
'totalWilayah' => $totalWilayah,
]);
}
// ── Helper: bangun data markers per periode ──
private function buildMarkers(?int $periodeId)
{
$wilayah = Wilayah::with('warga')->get();
// Query penerima — filter per periode jika ada
$query = HasilSaw::where('status', 'penerima');
if ($periodeId) {
$query->where('periode_id', $periodeId);
}
$hasilPenerima = $query->get()->groupBy('warga_id');
return $wilayah->map(function ($w) use ($hasilPenerima) {
$jumlahPenerima = 0;
$totalSkor = 0;
$count = 0;
foreach ($w->warga as $warga) {
if (isset($hasilPenerima[$warga->id])) {
foreach ($hasilPenerima[$warga->id] as $hasil) {
$jumlahPenerima++;
$totalSkor += $hasil->skor_akhir;
$count++;
}
}
}
$avgSkor = $count > 0 ? round($totalSkor / $count, 4) : 0;
return [
'dusun' => $w->dusun,
'rw' => $w->rw,
'latitude' => (float) $w->latitude,
'longitude' => (float) $w->longitude,
'jumlah_penerima' => $jumlahPenerima,
'avg_skor' => $avgSkor,
'label' => "Dusun {$w->dusun} / RW {$w->rw}",
];
})->filter(fn($m) => $m['latitude'] !== 0.0 && $m['longitude'] !== 0.0);
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace App\Http\Requests\Auth;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class LoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'email' => ['required', 'string', 'email'],
'password' => ['required', 'string'],
];
}
/**
* Attempt to authenticate the request's credentials.
*
* @throws ValidationException
*/
public function authenticate(): void
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
/**
* Ensure the login request is not rate limited.
*
* @throws ValidationException
*/
public function ensureIsNotRateLimited(): void
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}
event(new Lockout($this));
$seconds = RateLimiter::availableIn($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}
/**
* Get the rate limiting throttle key for the request.
*/
public function throttleKey(): string
{
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests;
use App\Models\User;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => [
'required',
'string',
'lowercase',
'email',
'max:255',
Rule::unique(User::class)->ignore($this->user()->id),
],
];
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Imports;
use App\Models\Kriteria;
use App\Models\PenilaianWarga;
use App\Models\Warga;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class PenilaianWargaImport implements ToCollection, WithHeadingRow
{
protected $periode_id;
protected $kriteria;
public function __construct($periode_id)
{
$this->periode_id = $periode_id;
$this->kriteria = Kriteria::orderBy('kode')->get();
}
public function headingRow(): int
{
return 9;
}
public function collection(Collection $rows)
{
foreach ($rows as $row) {
if (!isset($row['nik'])) continue;
$warga = Warga::where('nik', $row['nik'])->first();
if (!$warga) continue; // Warga harus ada di database
foreach ($this->kriteria as $k) {
$kode = strtolower($k->kode); // Excel heading mapping is usually lowercase
if (isset($row[$kode])) {
$nilai = intval($row[$kode]); // "1 - Petani" menjadi 1, "3" menjadi 3
if ($nilai > 0 && $nilai <= 5) {
PenilaianWarga::updateOrCreate(
[
'warga_id' => $warga->id,
'periode_id' => $this->periode_id,
'kriteria_id' => $k->id,
],
[
'nilai' => $nilai,
]
);
}
}
}
}
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Imports;
use App\Models\Warga;
use App\Models\Wilayah;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class WargaImport implements ToModel, WithHeadingRow
{
public function headingRow(): int
{
return 9;
}
public function model(array $row)
{
if (!isset($row['nik']) || !isset($row['nama_lengkap'])) {
return null;
}
// Cari atau buat wilayah berdasarkan dusun dan rw
$wilayah = null;
if (isset($row['dusun']) && isset($row['rw'])) {
$wilayah = Wilayah::firstOrCreate([
'dusun' => $row['dusun'],
'rw' => str_pad($row['rw'], 2, '0', STR_PAD_LEFT),
], [
'latitude' => 0,
'longitude' => 0,
]);
}
$warga = Warga::firstOrNew(['nik' => $row['nik']]);
$warga->nama = $row['nama_lengkap'];
// Hanya update alamat jika ada di excel, atau beri default jika data baru
if (isset($row['alamat'])) {
$warga->alamat = $row['alamat'];
} elseif (!$warga->exists) {
$warga->alamat = '-';
}
$warga->dusun = $row['dusun'] ?? '-';
$warga->rw = $row['rw'] ?? '-';
$warga->wilayah_id = $wilayah ? $wilayah->id : null;
if (!$warga->exists) {
$warga->rt = '00';
}
$warga->is_aktif = true;
$warga->save();
return $warga;
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DetailNormalisasi extends Model
{
protected $table = 'detail_normalisasi';
protected $fillable = [
'hasil_saw_id',
'kriteria_id',
'nilai_asli',
'nilai_normalisasi',
'nilai_terbobot',
];
protected $casts = [
'nilai_asli' => 'decimal:2',
'nilai_normalisasi' => 'decimal:6',
'nilai_terbobot' => 'decimal:6',
];
public function hasilSaw()
{
return $this->belongsTo(HasilSaw::class, 'hasil_saw_id');
}
public function kriteria()
{
return $this->belongsTo(Kriteria::class, 'kriteria_id');
}
}

37
app/Models/HasilSaw.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class HasilSaw extends Model
{
protected $table = 'hasil_saw';
protected $fillable = [
'warga_id',
'periode_id',
'skor_akhir',
'ranking',
'status',
];
protected $casts = [
'skor_akhir' => 'decimal:6',
];
public function warga()
{
return $this->belongsTo(Warga::class, 'warga_id');
}
public function periode()
{
return $this->belongsTo(PeriodeSeleksi::class, 'periode_id');
}
public function detailNormalisasi()
{
return $this->hasMany(DetailNormalisasi::class, 'hasil_saw_id');
}
}

33
app/Models/Kriteria.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Kriteria extends Model
{
protected $table = 'kriteria';
protected $fillable = [
'kode',
'nama',
'jenis',
'bobot',
];
protected $casts = [
'bobot' => 'decimal:2',
];
// Relasi ke penilaian
public function penilaian()
{
return $this->hasMany(PenilaianWarga::class, 'kriteria_id');
}
// Relasi ke sub-kriteria
public function subKriteria()
{
return $this->hasMany(SubKriteria::class, 'kriteria_id')->orderBy('nilai');
}
}

View File

@ -0,0 +1,92 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PenilaianWarga extends Model
{
protected $table = 'penilaian_warga';
protected $fillable = [
'warga_id',
'periode_id',
'kriteria_id',
'nilai',
];
protected $casts = [
'nilai' => 'decimal:2',
];
// Relasi ke Warga
public function warga()
{
return $this->belongsTo(Warga::class, 'warga_id');
}
// Relasi ke Periode Seleksi
public function periode()
{
return $this->belongsTo(PeriodeSeleksi::class, 'periode_id');
}
// Relasi ke Kriteria
public function kriteria()
{
return $this->belongsTo(Kriteria::class, 'kriteria_id');
}
// Helper: Get label untuk nilai berdasarkan kriteria
public static function getNilaiLabel($kriteriaKode, $nilai)
{
// Cari keterangan dari tabel database sub_kriteria
$sub = \App\Models\SubKriteria::whereHas('kriteria', function($q) use ($kriteriaKode) {
$q->where('kode', $kriteriaKode);
})->where('nilai', (int)$nilai)->first();
if ($sub) {
return $sub->keterangan;
}
$labels = [
'C1' => [
1 => 'Tidak bekerja / Buruh harian lepas',
2 => 'Petani kecil / Nelayan kecil',
3 => 'Pedagang kecil / Wiraswasta kecil',
4 => 'Karyawan swasta / PNS Golongan rendah',
5 => 'PNS / Profesional / Pengusaha',
],
'C2' => [
1 => '1 orang',
2 => '2 orang',
3 => '3 orang',
4 => '4 orang',
5 => '> 4 orang',
],
'C3' => [
1 => 'Sehat, usia produktif',
2 => 'Sehat, lanjut usia',
3 => 'Sering sakit ringan / Lansia tunggal',
4 => 'Sakit menahun / Disabilitas ringan',
5 => 'Sakit kronis parah / Disabilitas berat',
],
'C4' => [
1 => '20 - 30 tahun',
2 => '31 - 40 tahun',
3 => '41 - 50 tahun',
4 => '51 - 60 tahun',
5 => '> 60 tahun',
],
'C5' => [
1 => 'Belum pernah menerima bantuan',
2 => 'Pernah menerima (> 2 tahun lalu)',
3 => 'Pernah menerima (1 - 2 tahun lalu)',
4 => 'Aktif menerima 1 jenis bantuan',
5 => 'Aktif menerima banyak jenis bantuan',
],
];
return $labels[$kriteriaKode][$nilai] ?? $nilai;
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PenilaianWarga extends Model
{
protected $table = 'penilaian_warga';
protected $fillable = [
'warga_id',
'periode_id',
'c1', // penghasilan kepala keluarga
'c2', // jumlah tanggungan keluarga
'c3', // kondisi tempat tinggal
'c4', // status pekerjaan
'c5', // status kepemilikan rumah
'c6', // kepemilikan aset/kendaraan
'c7', // riwayat penerimaan bansos
];
public function warga()
{
return $this->belongsTo(Warga::class, 'warga_id');
}
public function periode()
{
return $this->belongsTo(PeriodeSeleksi::class, 'periode_id');
}
public function hasilSaw()
{
return $this->hasOne(HasilSaw::class, 'penilaian_id');
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PeriodeSeleksi extends Model
{
protected $table = 'periode_seleksi';
protected $fillable = [
'nama',
'tanggal_mulai',
'tanggal_selesai',
'kuota_penerima',
'kuota_cadangan',
'status',
];
// ✅ TAMBAHKAN INI untuk casting otomatis ke date
protected $casts = [
'tanggal_mulai' => 'date',
'tanggal_selesai' => 'date',
];
public function penilaian()
{
return $this->hasMany(PenilaianWarga::class, 'periode_id');
}
public function hasilSaw()
{
return $this->hasMany(HasilSaw::class, 'periode_id');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SubKriteria extends Model
{
protected $table = 'sub_kriteria';
protected $fillable = [
'kriteria_id',
'nilai',
'keterangan',
];
// Relasi balik ke kriteria
public function kriteria()
{
return $this->belongsTo(Kriteria::class, 'kriteria_id');
}
}

49
app/Models/User.php Normal file
View File

@ -0,0 +1,49 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable, \Spatie\Permission\Traits\HasRoles;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

44
app/Models/Warga.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Warga extends Model
{
protected $table = 'warga';
protected $fillable = [
'nik',
'nama',
'alamat',
'dusun',
'wilayah_id',
'rt',
'rw',
'pekerjaan',
'jumlah_tanggungan',
'usia',
'status_kesehatan',
'riwayat_bansos',
'no_telp',
'latitude',
'longitude',
'is_aktif',
];
public function penilaian()
{
return $this->hasMany(PenilaianWarga::class, 'warga_id');
}
public function hasilSaw()
{
return $this->hasMany(HasilSaw::class, 'warga_id');
}
public function wilayah()
{
return $this->belongsTo(Wilayah::class, 'wilayah_id');
}
}

27
app/Models/wilayah.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Wilayah extends Model
{
protected $table = 'wilayah';
protected $fillable = [
'dusun',
'rw',
'latitude',
'longitude',
];
public function warga()
{
return $this->hasMany(Warga::class);
}
public function getLabelAttribute(): string
{
return "Dusun {$this->dusun} - RW {$this->rw}";
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
\Illuminate\Pagination\Paginator::useBootstrap();
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class AppLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.app');
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class GuestLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.guest');
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace App\Exports;
use App\Models\HasilSaw;
use App\Models\PeriodeSeleksi;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Concerns\WithColumnWidths;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
class HasilSawExport implements FromCollection, WithHeadings, WithTitle, WithStyles, WithColumnWidths
{
protected $periode;
public function __construct(PeriodeSeleksi $periode)
{
$this->periode = $periode;
}
public function collection()
{
return HasilSaw::with('warga')
->where('periode_id', $this->periode->id)
->orderBy('ranking')
->get()
->map(fn ($h) => [
'Ranking' => $h->ranking,
'Nama' => $h->warga->nama ?? '-',
'NIK' => $h->warga->nik ?? '-',
'Dusun' => $h->warga->dusun ?? '-',
'RW' => $h->warga->rw ?? '-',
'Skor Akhir' => number_format($h->skor_akhir, 6),
'Status' => ucfirst($h->status),
]);
}
public function headings(): array
{
return ['Ranking', 'Nama Warga', 'NIK', 'Dusun', 'RW', 'Skor Akhir', 'Status'];
}
public function title(): string
{
return 'Hasil SAW';
}
public function styles(Worksheet $sheet): array
{
return [
1 => [
'font' => ['bold' => true, 'color' => ['argb' => 'FFFFFFFF']],
'fill' => ['fillType' => Fill::FILL_SOLID, 'startColor' => ['argb' => 'FF198754']],
'alignment' => ['horizontal' => Alignment::HORIZONTAL_CENTER],
],
];
}
public function columnWidths(): array
{
return [
'A' => 10,
'B' => 28,
'C' => 20,
'D' => 16,
'E' => 8,
'F' => 16,
'G' => 16,
];
}
}

View File

@ -0,0 +1,155 @@
<?php
namespace App\Exports;
use App\Models\Kriteria;
use App\Models\PenilaianWarga;
use App\Models\Warga;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use PhpOffice\PhpSpreadsheet\Cell\StringValueBinder;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use Illuminate\Support\Facades\DB;
class PenilaianWargaExport extends StringValueBinder implements FromCollection, WithHeadings, WithCustomStartCell, WithEvents, WithCustomValueBinder
{
protected $periode_id;
protected $kriteria;
public function __construct($periode_id)
{
$this->periode_id = $periode_id;
$this->kriteria = Kriteria::orderBy('kode')->get();
}
private function getKeteranganNilai($kode_kriteria, $nilai)
{
if (!$nilai) return 0;
$keterangan = [
'C1' => [
1 => '1 - Tidak bekerja / Buruh harian lepas',
2 => '2 - Petani kecil / Nelayan kecil',
3 => '3 - Pedagang kecil / Wiraswasta kecil',
4 => '4 - Karyawan swasta / PNS Golongan rendah',
5 => '5 - PNS / Profesional / Pengusaha',
],
'C2' => [
1 => '1 - 1 orang',
2 => '2 - 2 orang',
3 => '3 - 3 orang',
4 => '4 - 4 orang',
5 => '5 - > 4 orang',
],
'C3' => [
1 => '1 - Sehat, usia produktif',
2 => '2 - Sehat, lanjut usia',
3 => '3 - Sering sakit ringan / Lansia tunggal',
4 => '4 - Sakit menahun / Disabilitas ringan',
5 => '5 - Sakit kronis parah / Disabilitas berat',
],
'C4' => [
1 => '1 - 20 - 30 tahun',
2 => '2 - 31 - 40 tahun',
3 => '3 - 41 - 50 tahun',
4 => '4 - 51 - 60 tahun',
5 => '5 - > 60 tahun',
],
'C5' => [
1 => '1 - Belum pernah menerima bantuan',
2 => '2 - Pernah menerima (> 2 tahun lalu)',
3 => '3 - Pernah menerima (1 - 2 tahun lalu)',
4 => '4 - Aktif menerima 1 jenis bantuan',
5 => '5 - Aktif menerima banyak jenis bantuan',
]
];
$nilaiInt = (int) $nilai;
return isset($keterangan[$kode_kriteria][$nilaiInt]) ? $keterangan[$kode_kriteria][$nilaiInt] : $nilai;
}
public function collection()
{
$wargaDinilai = DB::table('penilaian_warga')
->where('periode_id', $this->periode_id)
->distinct()
->pluck('warga_id');
$penilaian = PenilaianWarga::where('periode_id', $this->periode_id)
->get()
->groupBy('warga_id');
$warga = Warga::whereIn('id', $wargaDinilai)->orderBy('nama')->get();
$data = new Collection();
foreach ($warga as $w) {
$row = [
'nik' => $w->nik,
'nama' => $w->nama,
];
$penilaianWarga = $penilaian->get($w->id)?->keyBy('kriteria_id') ?? collect();
foreach ($this->kriteria as $k) {
$nilaiAngka = isset($penilaianWarga[$k->id]) ? $penilaianWarga[$k->id]->nilai : 0;
$row[$k->kode] = $this->getKeteranganNilai($k->kode, $nilaiAngka);
}
$data->push($row);
}
return $data;
}
public function headings(): array
{
$headers = ['NIK', 'Nama Lengkap'];
foreach ($this->kriteria as $k) {
$headers[] = $k->kode;
}
return $headers;
}
public function startCell(): string
{
return 'A9';
}
public function registerEvents(): array
{
return [
AfterSheet::class => function(AfterSheet $event) {
$sheet = $event->sheet->getDelegate();
$sheet->setCellValue('A1', 'PEMERINTAH KABUPATEN MOJOKERTO');
$sheet->setCellValue('A2', 'KECAMATAN PUNGGING');
$sheet->setCellValue('A3', 'DESA PUNGGING');
$sheet->setCellValue('A4', 'Jalan Raya Pungging No. 27 Pungging, Mojokerto, Jawa Timur');
$sheet->setCellValue('A5', 'Kode Pos 61384 Telp. (0321) 532733');
$sheet->setCellValue('A7', 'DATA PENILAIAN WARGA BLT-DD');
$lastColumn = $sheet->getHighestColumn();
for ($i = 1; $i <= 7; $i++) {
$sheet->mergeCells("A{$i}:{$lastColumn}{$i}");
}
$sheet->getStyle("A1:A7")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("A1:A3")->getFont()->setBold(true)->setSize(14);
$sheet->getStyle("A7")->getFont()->setBold(true)->setSize(12);
$sheet->getStyle("A9:{$lastColumn}9")->getFont()->setBold(true);
$sheet->getStyle("A9:{$lastColumn}9")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
foreach (range('A', $lastColumn) as $col) {
$sheet->getColumnDimension($col)->setAutoSize(true);
}
},
];
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Exports;
use App\Models\Warga;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use PhpOffice\PhpSpreadsheet\Cell\StringValueBinder;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
class WargaExport extends StringValueBinder implements FromCollection, WithHeadings, WithCustomStartCell, WithEvents, WithMapping, WithCustomValueBinder
{
public function collection()
{
return Warga::with('wilayah')->orderBy('nama')->get();
}
public function map($warga): array
{
return [
$warga->nik,
$warga->nama,
$warga->wilayah ? $warga->wilayah->dusun : $warga->dusun,
$warga->wilayah ? $warga->wilayah->rw : $warga->rw,
];
}
public function headings(): array
{
return [
'NIK',
'Nama Lengkap',
'Dusun',
'RW',
];
}
public function startCell(): string
{
return 'A9';
}
public function registerEvents(): array
{
return [
AfterSheet::class => function(AfterSheet $event) {
$sheet = $event->sheet->getDelegate();
// Set Kop Data
$sheet->setCellValue('A1', 'PEMERINTAH KABUPATEN MOJOKERTO');
$sheet->setCellValue('A2', 'KECAMATAN PUNGGING');
$sheet->setCellValue('A3', 'DESA PUNGGING');
$sheet->setCellValue('A4', 'Jalan Raya Pungging No. 27 Pungging, Mojokerto, Jawa Timur');
$sheet->setCellValue('A5', 'Kode Pos 61384 Telp. (0321) 532733');
$sheet->setCellValue('A7', 'DATA WARGA BLT-DD');
// Merge Cells
for ($i = 1; $i <= 7; $i++) {
$sheet->mergeCells("A{$i}:D{$i}");
}
// Styling
$sheet->getStyle('A1:A7')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle('A1:A3')->getFont()->setBold(true)->setSize(14);
$sheet->getStyle('A7')->getFont()->setBold(true)->setSize(12);
$sheet->getStyle('A9:D9')->getFont()->setBold(true);
$sheet->getStyle('A9:D9')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// Auto-size columns
foreach (range('A', 'D') as $col) {
$sheet->getColumnDimension($col)->setAutoSize(true);
}
},
];
}
}

18
artisan Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status);

25
bootstrap/app.php Normal file
View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__ . '/../routes/web.php',
commands: __DIR__ . '/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->alias([
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
]);
// Redirect user yang sudah login ke admin dashboard
$middleware->redirectUsersTo(fn () => route('admin.dashboard'));
})
->withExceptions(function (Exceptions $exceptions): void {
//
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

7
bootstrap/providers.php Normal file
View File

@ -0,0 +1,7 @@
<?php
use App\Providers\AppServiceProvider;
return [
AppServiceProvider::class,
];

67
calc_formula.php Normal file
View File

@ -0,0 +1,67 @@
<?php
require 'vendor/autoload.php';
$app = require_once 'bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
$periode = \App\Models\PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periode) {
echo "Tidak ada periode aktif.";
exit;
}
$names = ['GIMO', 'SATUMI', 'NUR DIANA'];
$kriteria = \App\Models\Kriteria::orderBy('kode')->get();
$statPerKriteria = \App\Models\PenilaianWarga::where('periode_id', $periode->id)
->groupBy('kriteria_id')
->selectRaw('kriteria_id, MAX(nilai) as max_val, MIN(nilai) as min_val')
->get()
->keyBy('kriteria_id');
foreach ($names as $name) {
$wargaList = \App\Models\Warga::where('nama', 'LIKE', '%' . $name . '%')->get();
foreach ($wargaList as $warga) {
$penilaian = \App\Models\PenilaianWarga::where('warga_id', $warga->id)
->where('periode_id', $periode->id)
->get()
->keyBy('kriteria_id');
if ($penilaian->count() < 5) continue;
$normStr = [];
$terbobotStr = [];
$skorTotal = 0;
foreach ($kriteria as $k) {
$nilaiAsli = $penilaian[$k->id]->nilai;
$stat = $statPerKriteria[$k->id];
$max = $stat->max_val;
$min = $stat->min_val;
if ($k->jenis === 'benefit') {
$nilaiNormalisasi = $max > 0 ? $nilaiAsli / $max : 0;
} else {
$nilaiNormalisasi = $nilaiAsli > 0 ? $min / $nilaiAsli : 0;
}
$nilaiTerbobot = $nilaiNormalisasi * $k->bobot;
$skorTotal += $nilaiTerbobot;
$normFmt = number_format($nilaiNormalisasi, 3);
$bobotFmt = number_format($k->bobot, 2);
$terbobotFmt = number_format($nilaiTerbobot, 3);
$normStr[] = "({$normFmt} × {$bobotFmt})";
$terbobotStr[] = $terbobotFmt;
}
$totalFmt = number_format($skorTotal, 3);
echo "**{$warga->nama}**\n";
echo implode(" + ", $normStr) . " = " . implode(" + ", $terbobotStr) . " = **{$totalFmt}**\n\n";
}
}

90
composer.json Normal file
View File

@ -0,0 +1,90 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"barryvdh/laravel-dompdf": "^3.1",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1",
"maatwebsite/excel": "^3.1",
"spatie/laravel-permission": "^6.24"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.4",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^11.5.50"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"setup": [
"composer install",
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php artisan key:generate",
"@php artisan migrate --force",
"npm install",
"npm run build"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
],
"test": [
"@php artisan config:clear --ansi",
"@php artisan test"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"pre-package-uninstall": [
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

9656
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
config/app.php Normal file
View File

@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

117
config/auth.php Normal file
View File

@ -0,0 +1,117 @@
<?php
use App\Models\User;
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the number of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

117
config/cache.php Normal file
View File

@ -0,0 +1,117 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane",
| "failover", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
];

184
config/database.php Normal file
View File

@ -0,0 +1,184 @@
<?php
use Illuminate\Support\Str;
use Pdo\Mysql;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => env('DB_SSLMODE', 'prefer'),
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];

380
config/excel.php Normal file
View File

@ -0,0 +1,380 @@
<?php
use Maatwebsite\Excel\Excel;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => Csv::GUESS_ENCODING,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
/*
|--------------------------------------------------------------------------
| Cell Middleware
|--------------------------------------------------------------------------
|
| Configure middleware that is executed on getting a cell value
|
*/
'cells' => [
'middleware' => [
//\Maatwebsite\Excel\Middleware\TrimCellValue::class,
//\Maatwebsite\Excel\Middleware\ConvertEmptyCellValuesToNull::class,
],
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
/*
|--------------------------------------------------------------------------
| Cache Time-to-live (TTL)
|--------------------------------------------------------------------------
|
| The TTL of items written to cache. If you want to keep the items cached
| indefinitely, set this to null. Otherwise, set a number of seconds,
| a \DateInterval, or a callable.
|
| Allowable types: callable|\DateInterval|int|null
|
*/
'default_ttl' => 10800,
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
| permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Local Temporary Path Permissions
|--------------------------------------------------------------------------
|
| Permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
| If omitted the default permissions of the filesystem will be used.
|
*/
'local_permissions' => [
// 'dir' => 0755,
// 'file' => 0644,
],
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];

80
config/filesystems.php Normal file
View File

@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

118
config/mail.php Normal file
View File

@ -0,0 +1,118 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')),
],
];

202
config/permission.php Normal file
View File

@ -0,0 +1,202 @@
<?php
return [
'models' => [
/*
* When using the "HasPermissions" trait from this package, we need to know which
* Eloquent model should be used to retrieve your permissions. Of course, it
* is often just the "Permission" model but you may use whatever you like.
*
* The model you want to use as a Permission model needs to implement the
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Spatie\Permission\Models\Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your roles. Of course, it
* is often just the "Role" model but you may use whatever you like.
*
* The model you want to use as a Role model needs to implement the
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Spatie\Permission\Models\Role::class,
],
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
],
'column_names' => [
/*
* Change this if you want to name the related pivots other than defaults
*/
'role_pivot_key' => null, // default 'role_id',
'permission_pivot_key' => null, // default 'permission_id',
/*
* Change this if you want to name the related model primary key other than
* `model_id`.
*
* For example, this would be nice if your primary keys are all UUIDs. In
* that case, name this `model_uuid`.
*/
'model_morph_key' => 'model_id',
/*
* Change this if you want to use the teams feature and your related model's
* foreign key is other than `team_id`.
*/
'team_foreign_key' => 'team_id',
],
/*
* When set to true, the method for checking permissions will be registered on the gate.
* Set this to false if you want to implement custom logic for checking permissions.
*/
'register_permission_check_method' => true,
/*
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
*/
'register_octane_reset_listener' => false,
/*
* Events will fire when a role or permission is assigned/unassigned:
* \Spatie\Permission\Events\RoleAttached
* \Spatie\Permission\Events\RoleDetached
* \Spatie\Permission\Events\PermissionAttached
* \Spatie\Permission\Events\PermissionDetached
*
* To enable, set to true, and then create listeners to watch these events.
*/
'events_enabled' => false,
/*
* Teams Feature.
* When set to true the package implements teams using the 'team_foreign_key'.
* If you want the migrations to register the 'team_foreign_key', you must
* set this to true before doing the migration.
* If you already did the migration then you must make a new migration to also
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
* (view the latest version of this package's migration file)
*/
'teams' => false,
/*
* The class to use to resolve the permissions team id
*/
'team_resolver' => \Spatie\Permission\DefaultTeamResolver::class,
/*
* Passport Client Credentials Grant
* When set to true the package will use Passports Client to check permissions
*/
'use_passport_client_credentials' => false,
/*
* When set to true, the required permission names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_permission_in_exception' => false,
/*
* When set to true, the required role names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_role_in_exception' => false,
/*
* By default wildcard permission lookups are disabled.
* See documentation to understand supported syntax.
*/
'enable_wildcard_permission' => false,
/*
* The class to use for interpreting wildcard permissions.
* If you need to modify delimiters, override the class and specify its name here.
*/
// 'wildcard_permission' => Spatie\Permission\WildcardPermission::class,
/* Cache-specific settings */
'cache' => [
/*
* By default all permissions are cached for 24 hours to speed up performance.
* When permissions or roles are updated the cache is flushed automatically.
*/
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
/*
* The cache key used to store all permissions.
*/
'key' => 'spatie.permission.cache',
/*
* You may optionally indicate a specific cache driver to use for permission and
* role caching using any of the `store` drivers listed in the cache.php config
* file. Using 'default' here means to use the `default` set in cache.php.
*/
'store' => 'default',
],
];

129
config/queue.php Normal file
View File

@ -0,0 +1,129 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
| "deferred", "background", "failover", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
'deferred' => [
'driver' => 'deferred',
],
'background' => [
'driver' => 'background',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

38
config/services.php Normal file
View File

@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];

217
config/session.php Normal file
View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "memcached",
| "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain without subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,45 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -0,0 +1,59 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue');
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
$table->index(['queue', 'reserved_at', 'available_at']);
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,134 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$teams = config('permission.teams');
$tableNames = config('permission.table_names');
$columnNames = config('permission.column_names');
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
throw_if($teams && empty($columnNames['team_foreign_key'] ?? null), Exception::class, 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
Schema::create($tableNames['permissions'], static function (Blueprint $table) {
// $table->engine('InnoDB');
$table->bigIncrements('id'); // permission id
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->timestamps();
$table->unique(['name', 'guard_name']);
});
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) {
// $table->engine('InnoDB');
$table->bigIncrements('id'); // role id
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
}
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->timestamps();
if ($teams || config('permission.testing')) {
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
} else {
$table->unique(['name', 'guard_name']);
}
});
Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
$table->unsignedBigInteger($pivotPermission);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
$table->foreign($pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
} else {
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
}
});
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
$table->unsignedBigInteger($pivotRole);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
$table->foreign($pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
} else {
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
}
});
Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
$table->unsignedBigInteger($pivotPermission);
$table->unsignedBigInteger($pivotRole);
$table->foreign($pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign($pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
});
app('cache')
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
/**
* Reverse the migrations.
*/
public function down(): void
{
$tableNames = config('permission.table_names');
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
Schema::drop($tableNames['role_has_permissions']);
Schema::drop($tableNames['model_has_roles']);
Schema::drop($tableNames['model_has_permissions']);
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
};

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('warga', function (Blueprint $table) {
$table->id();
$table->string('nik', 16)->unique();
$table->string('nama');
$table->string('alamat');
$table->string('dusun')->nullable();
$table->string('rt')->nullable();
$table->string('rw')->nullable();
$table->string('no_telp')->nullable();
$table->decimal('latitude', 10, 8)->nullable();
$table->decimal('longitude', 11, 8)->nullable();
$table->boolean('is_aktif')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('warga');
}
};

View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('kriteria', function (Blueprint $table) {
$table->id();
$table->string('kode', 10)->unique(); // C1, C2, dll
$table->string('nama');
$table->enum('jenis', ['benefit', 'cost']);
$table->decimal('bobot', 5, 2); // Format: 0.25 (bukan 25)
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('kriteria');
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('periode_seleksi', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->date('tanggal_mulai');
$table->date('tanggal_selesai');
$table->integer('kuota_penerima')->default(0);
$table->enum('status', ['aktif', 'selesai', 'arsip'])->default('aktif');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('periode_seleksi');
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('penilaian_warga', function (Blueprint $table) {
$table->id();
$table->foreignId('warga_id')->constrained('warga')->onDelete('cascade');
$table->foreignId('periode_id')->constrained('periode_seleksi')->onDelete('cascade');
$table->foreignId('kriteria_id')->constrained('kriteria')->onDelete('cascade');
$table->decimal('nilai', 8, 2);
$table->timestamps();
$table->unique(['warga_id', 'periode_id', 'kriteria_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('penilaian_warga');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('hasil_saw', function (Blueprint $table) {
$table->id();
$table->foreignId('warga_id')->constrained('warga')->onDelete('cascade');
$table->foreignId('periode_id')->constrained('periode_seleksi')->onDelete('cascade');
$table->decimal('skor_akhir', 10, 6);
$table->integer('ranking');
$table->enum('status', ['penerima', 'tidak_penerima', 'cadangan'])->default('tidak_penerima');
$table->timestamps();
$table->unique(['warga_id', 'periode_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('hasil_saw');
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('detail_normalisasi', function (Blueprint $table) {
$table->id();
$table->foreignId('hasil_saw_id')->constrained('hasil_saw')->onDelete('cascade');
$table->foreignId('kriteria_id')->constrained('kriteria')->onDelete('cascade');
$table->decimal('nilai_asli', 8, 2);
$table->decimal('nilai_normalisasi', 10, 6);
$table->decimal('nilai_terbobot', 10, 6);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('detail_normalisasi');
}
};

View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('wilayah', function (Blueprint $table) {
$table->id();
$table->string('dusun', 100);
$table->string('rw', 5);
$table->decimal('latitude', 10, 7);
$table->decimal('longitude', 10, 7);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('wilayah');
}
};

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('warga', function (Blueprint $table) {
$table->foreignId('wilayah_id')->nullable()->constrained('wilayah')->nullOnDelete();
});
}
public function down(): void
{
Schema::table('warga', function (Blueprint $table) {
$table->dropForeign(['wilayah_id']);
$table->dropColumn('wilayah_id');
});
}
};

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
// Ubah semua status 'draft' menjadi 'aktif' dulu (jika ada)
DB::table('periode_seleksi')
->where('status', 'draft')
->update(['status' => 'aktif']);
// Ubah tipe kolom enum
DB::statement("ALTER TABLE periode_seleksi MODIFY COLUMN status ENUM('aktif', 'selesai', 'arsip') DEFAULT 'aktif'");
}
public function down(): void
{
// Kembalikan ke enum lama jika rollback
DB::statement("ALTER TABLE periode_seleksi MODIFY COLUMN status ENUM('draft', 'aktif', 'selesai', 'arsip') DEFAULT 'aktif'");
}
};

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
// Ubah status 'draft' menjadi 'aktif'
DB::table('periode_seleksi')
->where('status', 'draft')
->update(['status' => 'aktif']);
// Ubah enum
DB::statement("ALTER TABLE periode_seleksi MODIFY COLUMN status ENUM('aktif', 'selesai', 'arsip') DEFAULT 'aktif'");
}
public function down(): void
{
DB::statement("ALTER TABLE periode_seleksi MODIFY COLUMN status ENUM('draft', 'aktif', 'selesai', 'arsip') DEFAULT 'aktif'");
}
};

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('periode_seleksi', function (Blueprint $table) {
$table->integer('kuota_cadangan')->default(5)->after('kuota_penerima');
});
}
public function down(): void
{
Schema::table('periode_seleksi', function (Blueprint $table) {
$table->dropColumn('kuota_cadangan');
});
}
};

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('warga', function (Blueprint $table) {
$table->string('pekerjaan')->nullable()->after('rw');
$table->integer('jumlah_tanggungan')->nullable()->after('pekerjaan');
$table->integer('usia')->nullable()->after('jumlah_tanggungan');
$table->string('status_kesehatan')->nullable()->after('usia');
$table->string('riwayat_bansos')->nullable()->after('status_kesehatan');
});
}
public function down(): void
{
Schema::table('warga', function (Blueprint $table) {
$table->dropColumn(['pekerjaan', 'jumlah_tanggungan', 'usia', 'status_kesehatan', 'riwayat_bansos']);
});
}
};

View File

@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('sub_kriteria', function (Blueprint $table) {
$table->id();
$table->foreignId('kriteria_id')->constrained('kriteria')->onDelete('cascade');
$table->integer('nilai'); // 1 sampai 5
$table->string('keterangan');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('sub_kriteria');
}
};

View File

@ -0,0 +1,233 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Models\Warga;
use App\Models\PenilaianWarga;
use App\Models\Kriteria;
use App\Models\PeriodeSeleksi;
use Carbon\Carbon;
class DataWargaSeeder extends Seeder
{
public function run(): void
{
// Nonaktifkan foreign key checks untuk bersihkan tabel
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
DB::table('detail_normalisasi')->truncate();
DB::table('hasil_saw')->truncate();
DB::table('penilaian_warga')->truncate();
DB::table('warga')->truncate();
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
// Ambil data Periode Aktif atau buat baru jika belum ada
$periode = PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periode) {
$periode = PeriodeSeleksi::create([
'nama' => 'Penyaluran BLT-DD Tahap 1',
'tanggal_mulai' => Carbon::now()->startOfMonth(),
'tanggal_selesai' => Carbon::now()->endOfMonth(),
'kuota_penerima' => 50,
'status' => 'aktif',
]);
$this->command->info("Membuat Periode Seleksi otomatis...");
}
// Ambil ID Kriteria
$kriteriaId = [
'C1' => Kriteria::where('kode', 'C1')->value('id'),
'C2' => Kriteria::where('kode', 'C2')->value('id'),
'C3' => Kriteria::where('kode', 'C3')->value('id'),
'C4' => Kriteria::where('kode', 'C4')->value('id'),
'C5' => Kriteria::where('kode', 'C5')->value('id'),
];
// Ambil semua data wilayah agar bisa diacak
$wilayahList = \App\Models\Wilayah::all();
if ($wilayahList->isEmpty()) {
$this->command->error("Tabel Wilayah kosong! Jalankan php artisan db:seed --class=WilayahSeeder terlebih dahulu.");
return;
}
// Baca CSV
$filename = base_path('Desa Pungging. Pungging Data KPM BLT Dana Desa 2022 dipakai.csv');
if (!file_exists($filename)) {
$this->command->error("File CSV tidak ditemukan!");
return;
}
$file = fopen($filename, 'r');
$rowNum = 0;
$inserted = 0;
while (($row = fgetcsv($file, 1000, ';')) !== FALSE) {
$rowNum++;
// Data warga mulai dari baris 16 sampai 116
if ($rowNum < 16) continue;
if (empty($row[1]) || empty($row[2])) break; // Berhenti jika kosong atau sampai rekap
$nama = trim($row[1]);
$nik = trim($row[2]);
$pekerjaanCsv = trim(strtoupper($row[3]));
// Pilih wilayah secara acak untuk warga ini
$wilayahAcak = $wilayahList->random();
$rt_acak = str_pad(rand(1, 5), 2, '0', STR_PAD_LEFT); // Asumsi tiap RW punya RT 01-05
// Tambahkan sedikit pengacakan koordinat (sekitar 10-30 meter) agar marker tidak bertumpuk di peta GIS
$lat_jitter = rand(-300, 300) / 1000000;
$lng_jitter = rand(-300, 300) / 1000000;
// 2. Kalkulasi Nilai Kriteria & Data Mentah
// MENGHITUNG USIA DAN JENIS KELAMIN LEBIH DULU
// NIK: 35 16 06 71 12 63 0011 -> 71=Tgl, 12=Bln, 63=Thn
$tgl = (int) substr($nik, 6, 2);
$thn = (int) substr($nik, 10, 2);
$is_perempuan = false;
// Perempuan tgl > 40
if ($tgl > 40) {
$tgl -= 40;
$is_perempuan = true;
}
$thnLahir = $thn > 24 ? 1900 + $thn : 2000 + $thn;
$usia = date('Y') - $thnLahir;
// C4: Nilai Usia
$valC4 = 1;
if ($usia >= 20 && $usia <= 30) $valC4 = 1;
elseif ($usia >= 31 && $usia <= 40) $valC4 = 2;
elseif ($usia >= 41 && $usia <= 50) $valC4 = 3;
elseif ($usia >= 51 && $usia <= 60) $valC4 = 4;
elseif ($usia > 60) $valC4 = 5;
// C1: Pekerjaan (Logika disesuaikan dengan Usia dan Gender)
$pekerjaanStr = ucfirst(strtolower($pekerjaanCsv));
$valC1 = 1;
if ($usia > 60) {
// Lansia di atas 60 tahun
$valC1 = 1;
if ($is_perempuan) {
$variasi = ['Tidak Bekerja', 'Pembantu Rumah Tangga', 'Tidak Bekerja / Lansia'];
} else {
$variasi = ['Tidak Bekerja', 'Tidak Bekerja / Lansia', 'Serabutan (Jarang)'];
}
$pekerjaanStr = $variasi[array_rand($variasi)];
} else {
// Usia Produktif
if (str_contains($pekerjaanCsv, 'BURUH TANI') || str_contains($pekerjaanCsv, 'BURUH NELAYAN')) {
$valC1 = 1;
if ($is_perempuan) {
$variasiBuruh = ['Buruh Tani', 'Buruh Tani', 'Buruh Tani', 'Pembantu Rumah Tangga'];
} else {
$variasiBuruh = ['Buruh Tani', 'Buruh Tani', 'Buruh Tani', 'Buruh Harian Lepas', 'Kuli Bangunan'];
}
$pekerjaanStr = $variasiBuruh[array_rand($variasiBuruh)];
} elseif (str_contains($pekerjaanCsv, 'LAIN-LAIN') || str_contains($pekerjaanCsv, 'PEDAGANG')) {
$skalaAcak = rand(1, 4);
if ($skalaAcak == 1) {
$variasi = $is_perempuan ? ['Serabutan', 'Pembantu Rumah Tangga', 'Tidak Bekerja'] : ['Serabutan', 'Tidak Bekerja', 'Kuli Bangunan'];
$pekerjaanStr = $variasi[array_rand($variasi)];
$valC1 = 1;
} elseif ($skalaAcak == 2) {
$variasi = $is_perempuan ? ['Pedagang Keliling', 'Peternak Kecil', 'Buruh Cuci'] : ['Petani Penggarap', 'Pedagang Keliling', 'Peternak Kecil', 'Tukang Becak'];
$pekerjaanStr = $variasi[array_rand($variasi)];
$valC1 = 2;
} elseif ($skalaAcak == 3) {
$variasi = $is_perempuan ? ['Warung Kecil', 'Tukang Jahit', 'Pedagang Kaki Lima'] : ['Pedagang Kaki Lima', 'Warung Kecil', 'Tukang Ojek', 'Tukang Jahit'];
$pekerjaanStr = $variasi[array_rand($variasi)];
$valC1 = 3;
} else {
$variasi = $is_perempuan ? ['Buruh Pabrik', 'Karyawan Toko', 'Guru Honorer'] : ['Buruh Pabrik', 'Karyawan Toko', 'Guru Honorer'];
$pekerjaanStr = $variasi[array_rand($variasi)];
$valC1 = 4;
}
} elseif (str_contains($pekerjaanCsv, 'PETANI') || str_contains($pekerjaanCsv, 'NELAYAN')) {
$valC1 = 2;
$pekerjaanStr = 'Petani Penggarap';
} elseif (str_contains($pekerjaanCsv, 'PABRIK')) {
$valC1 = 4;
$pekerjaanStr = 'Buruh Pabrik';
}
}
// C2: Tanggungan Keluarga (Random 1-5)
// C3: Kesehatan (Logika disesuaikan dengan Umur asli)
$chanceC3 = rand(1, 100);
if ($chanceC3 <= 80) {
// Jika umur > 50, maka Lansia. Jika tidak, Produktif.
if ($usia > 50) {
$valC3 = 2;
$kesehatanStr = 'Sehat, lanjut usia';
} else {
$valC3 = 1;
$kesehatanStr = 'Sehat, usia produktif';
}
} else {
$valC3 = rand(3, 5);
if ($valC3 == 3) {
$kesehatanStr = $usia > 50 ? 'Lansia tunggal / Sering sakit' : 'Sering sakit ringan';
} else {
$kesehatanStr = $valC3 == 4 ? 'Sakit menahun / Disabilitas ringan' : 'Sakit kronis parah / Disabilitas berat';
}
}
// C5: Riwayat Bansos (85% belum pernah terima nilai 1, sisanya pernah 2-4)
// Karena ini BLT DD, mayoritas penerima seharusnya yang belum terima bansos lain.
$chanceC5 = rand(1, 100);
if ($chanceC5 <= 85) {
$valC5 = 1;
$bansosStr = 'Belum pernah menerima bantuan';
} else {
$valC5 = rand(2, 4);
$bansosStr = $valC5 == 2 ? 'Pernah menerima (> 2 tahun lalu)' : ($valC5 == 3 ? 'Pernah menerima (1 - 2 tahun lalu)' : 'Aktif menerima 1 jenis bantuan');
}
// C2: Tanggungan Keluarga (Random 1-5)
$valC2 = rand(1, 5);
// 1. Simpan Warga beserta Data Mentah
$warga = Warga::create([
'nama' => $nama,
'nik' => $nik,
'alamat' => 'Desa ' . $wilayahAcak->dusun,
'dusun' => $wilayahAcak->dusun,
'rt' => $rt_acak,
'rw' => $wilayahAcak->rw,
'wilayah_id' => $wilayahAcak->id,
'pekerjaan' => $pekerjaanStr,
'jumlah_tanggungan' => $valC2,
'usia' => $usia,
'status_kesehatan' => $kesehatanStr,
'riwayat_bansos' => $bansosStr,
'latitude' => $wilayahAcak->latitude + $lat_jitter,
'longitude' => $wilayahAcak->longitude + $lng_jitter,
'is_aktif' => true,
]);
// Insert Penilaian
$penilaianData = [
['warga_id' => $warga->id, 'periode_id' => $periode->id, 'kriteria_id' => $kriteriaId['C1'], 'nilai' => $valC1],
['warga_id' => $warga->id, 'periode_id' => $periode->id, 'kriteria_id' => $kriteriaId['C2'], 'nilai' => $valC2],
['warga_id' => $warga->id, 'periode_id' => $periode->id, 'kriteria_id' => $kriteriaId['C3'], 'nilai' => $valC3],
['warga_id' => $warga->id, 'periode_id' => $periode->id, 'kriteria_id' => $kriteriaId['C4'], 'nilai' => $valC4],
['warga_id' => $warga->id, 'periode_id' => $periode->id, 'kriteria_id' => $kriteriaId['C5'], 'nilai' => $valC5],
];
DB::table('penilaian_warga')->insert($penilaianData);
$inserted++;
}
fclose($file);
$this->command->info("Berhasil memproses $inserted data warga beserta penilaiannya!");
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
public function run(): void
{
$this->call([
// 1. Role & Permission dulu
RoleSeeder::class,
// 2. Master data (tidak ada foreign key)
KriteriaSeeder::class,
WilayahSeeder::class,
// 3. Periode (sebelum penilaian)
PeriodeSeeder::class,
// 4. Warga (butuh wilayah_id)
WargaSeeder::class,
// 5. Penilaian (butuh warga_id, periode_id, kriteria_id)
PenilaianWargaSeeder::class,
]);
$this->command->info('');
$this->command->info('🎉 SEEDING SELESAI!');
$this->command->info('📊 Ringkasan:');
$this->command->info(' - 3 User (Superadmin, Admin, User)');
$this->command->info(' - 7 Kriteria (C1-C7)');
$this->command->info(' - 10 Wilayah (7 Dusun, 10 RW)');
$this->command->info(' - 1 Periode Aktif');
$this->command->info(' - 12 Warga');
$this->command->info(' - 84 Penilaian (12 × 7)');
$this->command->info('');
$this->command->info('✅ Login Superadmin: superadmin@desa.id / superadmin123');
$this->command->info('✅ Login Admin: admin@desa.id / admin123');
$this->command->info('✅ Login User: user@desa.id / user123');
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Kriteria;
class KriteriaSeeder extends Seeder
{
public function run(): void
{
$kriteria = [
['kode' => 'C1', 'nama' => 'Jenis Pekerjaan', 'jenis' => 'cost', 'bobot' => 0.25],
['kode' => 'C2', 'nama' => 'Jumlah Tanggungan Keluarga', 'jenis' => 'benefit', 'bobot' => 0.20],
['kode' => 'C3', 'nama' => 'Kondisi Kesehatan / Kerentanan Keluarga', 'jenis' => 'benefit', 'bobot' => 0.15],
['kode' => 'C4', 'nama' => 'Usia Kepala Keluarga', 'jenis' => 'benefit', 'bobot' => 0.10],
['kode' => 'C5', 'nama' => 'Riwayat Penerimaan Bantuan Sosial', 'jenis' => 'cost', 'bobot' => 0.30],
];
foreach ($kriteria as $k) {
// GUNAKAN updateOrCreate agar tidak error jika sudah ada
Kriteria::updateOrCreate(
['kode' => $k['kode']], // Cari berdasarkan kode
$k // Update dengan data baru
);
}
// Seeding Sub-Kriteria Default C1 - C5
$subKriteria = [
'C1' => [
1 => 'Tidak bekerja / Buruh harian lepas',
2 => 'Petani kecil / Nelayan kecil',
3 => 'Pedagang kecil / Wiraswasta kecil',
4 => 'Karyawan swasta / PNS Golongan rendah',
5 => 'PNS / Profesional / Pengusaha',
],
'C2' => [
1 => '1 orang',
2 => '2 orang',
3 => '3 orang',
4 => '4 orang',
5 => '> 4 orang',
],
'C3' => [
1 => 'Sehat, usia produktif',
2 => 'Sehat, lanjut usia',
3 => 'Sering sakit ringan / Lansia tunggal',
4 => 'Sakit menahun / Disabilitas ringan',
5 => 'Sakit kronis parah / Disabilitas berat',
],
'C4' => [
1 => '20 - 30 tahun',
2 => '31 - 40 tahun',
3 => '41 - 50 tahun',
4 => '51 - 60 tahun',
5 => '> 60 tahun',
],
'C5' => [
1 => 'Belum pernah menerima bantuan',
2 => 'Pernah menerima (> 2 tahun lalu)',
3 => 'Pernah menerima (1 - 2 tahun lalu)',
4 => 'Aktif menerima 1 jenis bantuan',
5 => 'Aktif menerima banyak jenis bantuan',
],
];
foreach ($subKriteria as $kode => $items) {
$kr = Kriteria::where('kode', $kode)->first();
if ($kr) {
foreach ($items as $nilai => $ket) {
\App\Models\SubKriteria::updateOrCreate(
['kriteria_id' => $kr->id, 'nilai' => $nilai],
['keterangan' => $ket]
);
}
}
}
// Hapus Kriteria C6 dan C7 yang sudah tidak dipakai
Kriteria::whereIn('kode', ['C6', 'C7'])->delete();
$this->command->info(' Kriteria & Sub-Kriteria berhasil di-seed/update!');
}
}

View File

@ -0,0 +1,89 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\PenilaianWarga;
use App\Models\Warga;
use App\Models\PeriodeSeleksi;
class PenilaianWargaSeeder extends Seeder
{
public function run(): void
{
$periode = PeriodeSeleksi::where('status', 'aktif')->first();
if (!$periode) {
$this->command->error('❌ Belum ada periode aktif! Jalankan PeriodeSeeder dulu.');
return;
}
// Ambil semua warga ordered by id
$warga = Warga::orderBy('id')->get();
if ($warga->count() === 0) {
$this->command->error('❌ Belum ada data warga! Jalankan WargaSeeder dulu.');
return;
}
// Nilai per warga: [C1, C2, C3, C4, C5, C6, C7]
// C1 Penghasilan → cost → nilai kecil = miskin
// C2 Tanggungan → benefit → nilai besar = banyak tanggungan
// C3 Kondisi rumah → cost → nilai kecil = rumah buruk
// C4 Status pekerjaan → cost → nilai kecil = tidak bekerja
// C5 Kepemilikan rmh → cost → nilai kecil = numpang/kontrak
// C6 Aset/kendaraan → cost → nilai kecil = tidak punya aset
// C7 Riwayat bansos → cost → nilai kecil = belum pernah terima
// Skala 1-5
$nilaiPerWarga = [
// Ahmad Fauzi — sangat miskin
[1, 5, 1, 1, 1, 1, 1],
// Siti Aminah — miskin
[1, 4, 2, 2, 1, 1, 2],
// Budi Santoso — miskin sedang
[2, 4, 2, 2, 2, 2, 1],
// Wati Rahayu — miskin sedang
[2, 3, 2, 3, 2, 2, 2],
// Suparman — sangat miskin
[1, 5, 1, 1, 1, 1, 1],
// Dewi Lestari — miskin
[2, 4, 2, 2, 2, 1, 2],
// Hasan Basri — cukup miskin
[2, 3, 3, 2, 2, 2, 3],
// Nurul Hidayah — miskin
[1, 4, 2, 2, 1, 2, 1],
// Joko Widodo — cukup
[3, 3, 3, 3, 3, 3, 3],
// Maryam — miskin
[2, 4, 2, 2, 2, 1, 2],
// Supardi — sangat miskin
[1, 5, 1, 1, 1, 1, 1],
// Rina Agustina — cukup miskin
[2, 3, 2, 2, 2, 2, 2],
];
$kriteriaList = \App\Models\Kriteria::orderBy('id')->get();
foreach ($warga as $index => $w) {
if (!isset($nilaiPerWarga[$index])) {
$this->command->warn("⚠️ Warga #{$w->id} ({$w->nama}) tidak ada data nilai, dilewati.");
continue;
}
$nilai = $nilaiPerWarga[$index];
foreach ($kriteriaList as $i => $kr) {
if (isset($nilai[$i])) {
PenilaianWarga::create([
'warga_id' => $w->id,
'periode_id' => $periode->id,
'kriteria_id' => $kr->id,
'nilai' => $nilai[$i],
]);
}
}
}
$this->command->info('✅ Penilaian warga berhasil dibuat untuk ' . $warga->count() . ' warga.');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\PeriodeSeleksi;
class PeriodeSeeder extends Seeder
{
public function run(): void
{
PeriodeSeleksi::create([
'nama' => 'BLT-DD Tahap 1 - 2024',
'tanggal_mulai' => '2024-01-01',
'tanggal_selesai' => '2024-12-31',
'kuota_penerima' => 10,
'status' => 'aktif',
]);
$this->command->info('✅ Periode BLT berhasil dibuat.');
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
use App\Models\User;
class RoleSeeder extends Seeder
{
public function run(): void
{
// Buat role jika belum ada
Role::firstOrCreate(['name' => 'superadmin']);
Role::firstOrCreate(['name' => 'admin']);
Role::firstOrCreate(['name' => 'user']);
// Buat akun superadmin jika belum ada
$superadmin = User::firstOrCreate(
['email' => 'superadmin@desa.id'],
[
'name' => 'Superadmin Desa',
'password' => bcrypt('superadmin123'),
]
);
$superadmin->syncRoles(['superadmin']);
// Buat akun admin jika belum ada
$admin = User::firstOrCreate(
['email' => 'admin@desa.id'],
[
'name' => 'Admin Desa',
'password' => bcrypt('admin123'),
]
);
$admin->syncRoles(['admin']);
// Buat akun user jika belum ada
$user = User::firstOrCreate(
['email' => 'user@desa.id'],
[
'name' => 'User Desa',
'password' => bcrypt('user123'),
]
);
$user->syncRoles(['user']);
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Warga;
use App\Models\Wilayah;
class WargaSeeder extends Seeder
{
public function run(): void
{
// Ambil wilayah dari DB (sudah di-seed sebelumnya)
$wilayah = Wilayah::all()->keyBy(fn ($w) => $w->dusun . '_' . $w->rw);
$data = [
// Dusun Pungging RW 03
['nik' => '3514010101800001', 'nama' => 'Ahmad Fauzi', 'alamat' => 'Dsn. Pungging RT 01', 'dusun' => 'Pungging', 'rt' => '01', 'rw' => '03'],
['nik' => '3514010201790002', 'nama' => 'Siti Aminah', 'alamat' => 'Dsn. Pungging RT 02', 'dusun' => 'Pungging', 'rt' => '02', 'rw' => '03'],
// Dusun Pungging RW 04
['nik' => '3514010301820003', 'nama' => 'Budi Santoso', 'alamat' => 'Dsn. Pungging RT 01', 'dusun' => 'Pungging', 'rt' => '01', 'rw' => '04'],
// Dusun Pungging RW 05
['nik' => '3514010401850004', 'nama' => 'Wati Rahayu', 'alamat' => 'Dsn. Pungging RT 02', 'dusun' => 'Pungging', 'rt' => '02', 'rw' => '05'],
// Dusun Patung RW 01
['nik' => '3514010501780005', 'nama' => 'Suparman', 'alamat' => 'Dsn. Patung RT 01', 'dusun' => 'Patung', 'rt' => '01', 'rw' => '01'],
['nik' => '3514010601830006', 'nama' => 'Dewi Lestari', 'alamat' => 'Dsn. Patung RT 02', 'dusun' => 'Patung', 'rt' => '02', 'rw' => '01'],
// Dusun Patung RW 02
['nik' => '3514010701760007', 'nama' => 'Hasan Basri', 'alamat' => 'Dsn. Patung RT 01', 'dusun' => 'Patung', 'rt' => '01', 'rw' => '02'],
// Dusun Mejerat RW 06
['nik' => '3514010801900008', 'nama' => 'Nurul Hidayah', 'alamat' => 'Dsn. Mejerat RT 01', 'dusun' => 'Mejerat', 'rt' => '01', 'rw' => '06'],
// Dusun Tamansari RW 07
['nik' => '3514010901880009', 'nama' => 'Joko Widodo', 'alamat' => 'Dsn. Tamansari RT 01', 'dusun' => 'Tamansari', 'rt' => '01', 'rw' => '07'],
// Dusun Kanigoro RW 08
['nik' => '3514011001750010', 'nama' => 'Maryam', 'alamat' => 'Dsn. Kanigoro RT 01', 'dusun' => 'Kanigoro', 'rt' => '01', 'rw' => '08'],
// Dusun Jagil RW 09
['nik' => '3514011101800011', 'nama' => 'Supardi', 'alamat' => 'Dsn. Jagil RT 01', 'dusun' => 'Jagil', 'rt' => '01', 'rw' => '09'],
// Dusun Gebang RW 10
['nik' => '3514011201920012', 'nama' => 'Rina Agustina', 'alamat' => 'Dsn. Gebang RT 01', 'dusun' => 'Gebang', 'rt' => '01', 'rw' => '10'],
];
foreach ($data as $item) {
$key = $item['dusun'] . '_' . $item['rw'];
$w = $wilayah->get($key);
Warga::create([
'nik' => $item['nik'],
'nama' => $item['nama'],
'alamat' => $item['alamat'],
'dusun' => $item['dusun'],
'rt' => $item['rt'],
'rw' => $item['rw'],
'no_telp' => null,
'is_aktif' => 1,
'wilayah_id' => $w?->id,
'latitude' => $w?->latitude,
'longitude' => $w?->longitude,
]);
}
$this->command->info('✅ 12 warga dummy berhasil dibuat dengan koordinat wilayah.');
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Models\Wilayah;
class WilayahSeeder extends Seeder
{
public function run(): void
{
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
Wilayah::truncate();
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
$data = [
// Dusun Patung
['dusun' => 'Patung', 'rw' => '01', 'latitude' => -7.519868, 'longitude' => 112.580683],
['dusun' => 'Patung', 'rw' => '02', 'latitude' => -7.523761, 'longitude' => 112.578666],
// Dusun Pungging
['dusun' => 'Pungging', 'rw' => '03', 'latitude' => -7.522941, 'longitude' => 112.584303],
['dusun' => 'Pungging', 'rw' => '04', 'latitude' => -7.524196, 'longitude' => 112.589066],
['dusun' => 'Pungging', 'rw' => '05', 'latitude' => -7.528557, 'longitude' => 112.585182],
// Dusun Mejerat
['dusun' => 'Mejerat', 'rw' => '06', 'latitude' => -7.527225, 'longitude' => 112.578202],
// Dusun Tamansari
['dusun' => 'Tamansari', 'rw' => '07', 'latitude' => -7.529855, 'longitude' => 112.573673],
// Dusun Kanigoro
['dusun' => 'Kanigoro', 'rw' => '08', 'latitude' => -7.532500, 'longitude' => 112.571800],
// ✅ FIX: Jagil = RW 09, Gebang = RW 10
['dusun' => 'Jagil', 'rw' => '09', 'latitude' => -7.538858, 'longitude' => 112.578704],
['dusun' => 'Gebang', 'rw' => '10', 'latitude' => -7.532936, 'longitude' => 112.580108],
];
foreach ($data as $item) {
Wilayah::create($item);
}
$this->command->info('✅ 10 wilayah berhasil dibuat dengan koordinat nyata.');
}
}

1
get_10.php Normal file
View File

@ -0,0 +1 @@
// Temp file cleared

17
get_ranking.php Normal file
View File

@ -0,0 +1,17 @@
<?php
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
$top = App\Models\HasilSaw::with('warga')->orderBy('ranking')->take(3)->get();
echo "TOP:\n";
foreach($top as $t) {
echo $t->warga->nama . " (" . number_format($t->skor_akhir, 3) . ")\n";
}
$bot = App\Models\HasilSaw::with('warga')->orderByDesc('ranking')->take(1)->get();
echo "BOTTOM:\n";
foreach($bot as $b) {
echo $b->warga->nama . " (" . number_format($b->skor_akhir, 3) . ")\n";
}

20
lang/en/auth.php Normal file
View File

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'password' => 'The provided password is incorrect.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];

19
lang/en/pagination.php Normal file
View File

@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
];

22
lang/en/passwords.php Normal file
View File

@ -0,0 +1,22 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| outcome such as failure due to an invalid password / reset token.
|
*/
'reset' => 'Your password has been reset.',
'sent' => 'We have emailed your password reset link.',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",
];

200
lang/en/validation.php Normal file
View File

@ -0,0 +1,200 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute field must be accepted.',
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
'active_url' => 'The :attribute field must be a valid URL.',
'after' => 'The :attribute field must be a date after :date.',
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
'alpha' => 'The :attribute field must only contain letters.',
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
'any_of' => 'The :attribute field is invalid.',
'array' => 'The :attribute field must be an array.',
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
'before' => 'The :attribute field must be a date before :date.',
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
'between' => [
'array' => 'The :attribute field must have between :min and :max items.',
'file' => 'The :attribute field must be between :min and :max kilobytes.',
'numeric' => 'The :attribute field must be between :min and :max.',
'string' => 'The :attribute field must be between :min and :max characters.',
],
'boolean' => 'The :attribute field must be true or false.',
'can' => 'The :attribute field contains an unauthorized value.',
'confirmed' => 'The :attribute field confirmation does not match.',
'contains' => 'The :attribute field is missing a required value.',
'current_password' => 'The password is incorrect.',
'date' => 'The :attribute field must be a valid date.',
'date_equals' => 'The :attribute field must be a date equal to :date.',
'date_format' => 'The :attribute field must match the format :format.',
'decimal' => 'The :attribute field must have :decimal decimal places.',
'declined' => 'The :attribute field must be declined.',
'declined_if' => 'The :attribute field must be declined when :other is :value.',
'different' => 'The :attribute field and :other must be different.',
'digits' => 'The :attribute field must be :digits digits.',
'digits_between' => 'The :attribute field must be between :min and :max digits.',
'dimensions' => 'The :attribute field has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'doesnt_contain' => 'The :attribute field must not contain any of the following: :values.',
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
'email' => 'The :attribute field must be a valid email address.',
'encoding' => 'The :attribute field must be encoded in :encoding.',
'ends_with' => 'The :attribute field must end with one of the following: :values.',
'enum' => 'The selected :attribute is invalid.',
'exists' => 'The selected :attribute is invalid.',
'extensions' => 'The :attribute field must have one of the following extensions: :values.',
'file' => 'The :attribute field must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'array' => 'The :attribute field must have more than :value items.',
'file' => 'The :attribute field must be greater than :value kilobytes.',
'numeric' => 'The :attribute field must be greater than :value.',
'string' => 'The :attribute field must be greater than :value characters.',
],
'gte' => [
'array' => 'The :attribute field must have :value items or more.',
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
'numeric' => 'The :attribute field must be greater than or equal to :value.',
'string' => 'The :attribute field must be greater than or equal to :value characters.',
],
'hex_color' => 'The :attribute field must be a valid hexadecimal color.',
'image' => 'The :attribute field must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field must exist in :other.',
'in_array_keys' => 'The :attribute field must contain at least one of the following keys: :values.',
'integer' => 'The :attribute field must be an integer.',
'ip' => 'The :attribute field must be a valid IP address.',
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
'json' => 'The :attribute field must be a valid JSON string.',
'list' => 'The :attribute field must be a list.',
'lowercase' => 'The :attribute field must be lowercase.',
'lt' => [
'array' => 'The :attribute field must have less than :value items.',
'file' => 'The :attribute field must be less than :value kilobytes.',
'numeric' => 'The :attribute field must be less than :value.',
'string' => 'The :attribute field must be less than :value characters.',
],
'lte' => [
'array' => 'The :attribute field must not have more than :value items.',
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute field must be less than or equal to :value.',
'string' => 'The :attribute field must be less than or equal to :value characters.',
],
'mac_address' => 'The :attribute field must be a valid MAC address.',
'max' => [
'array' => 'The :attribute field must not have more than :max items.',
'file' => 'The :attribute field must not be greater than :max kilobytes.',
'numeric' => 'The :attribute field must not be greater than :max.',
'string' => 'The :attribute field must not be greater than :max characters.',
],
'max_digits' => 'The :attribute field must not have more than :max digits.',
'mimes' => 'The :attribute field must be a file of type: :values.',
'mimetypes' => 'The :attribute field must be a file of type: :values.',
'min' => [
'array' => 'The :attribute field must have at least :min items.',
'file' => 'The :attribute field must be at least :min kilobytes.',
'numeric' => 'The :attribute field must be at least :min.',
'string' => 'The :attribute field must be at least :min characters.',
],
'min_digits' => 'The :attribute field must have at least :min digits.',
'missing' => 'The :attribute field must be missing.',
'missing_if' => 'The :attribute field must be missing when :other is :value.',
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
'missing_with' => 'The :attribute field must be missing when :values is present.',
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
'multiple_of' => 'The :attribute field must be a multiple of :value.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute field format is invalid.',
'numeric' => 'The :attribute field must be a number.',
'password' => [
'letters' => 'The :attribute field must contain at least one letter.',
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
'numbers' => 'The :attribute field must contain at least one number.',
'symbols' => 'The :attribute field must contain at least one symbol.',
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
],
'present' => 'The :attribute field must be present.',
'present_if' => 'The :attribute field must be present when :other is :value.',
'present_unless' => 'The :attribute field must be present unless :other is :value.',
'present_with' => 'The :attribute field must be present when :values is present.',
'present_with_all' => 'The :attribute field must be present when :values are present.',
'prohibited' => 'The :attribute field is prohibited.',
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
'prohibited_if_accepted' => 'The :attribute field is prohibited when :other is accepted.',
'prohibited_if_declined' => 'The :attribute field is prohibited when :other is declined.',
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
'prohibits' => 'The :attribute field prohibits :other from being present.',
'regex' => 'The :attribute field format is invalid.',
'required' => 'The :attribute field is required.',
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
'required_if_declined' => 'The :attribute field is required when :other is declined.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute field must match :other.',
'size' => [
'array' => 'The :attribute field must contain :size items.',
'file' => 'The :attribute field must be :size kilobytes.',
'numeric' => 'The :attribute field must be :size.',
'string' => 'The :attribute field must be :size characters.',
],
'starts_with' => 'The :attribute field must start with one of the following: :values.',
'string' => 'The :attribute field must be a string.',
'timezone' => 'The :attribute field must be a valid timezone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'uppercase' => 'The :attribute field must be uppercase.',
'url' => 'The :attribute field must be a valid URL.',
'ulid' => 'The :attribute field must be a valid ULID.',
'uuid' => 'The :attribute field must be a valid UUID.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [],
];

20
lang/id/auth.php Normal file
View File

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'Kredensial yang Anda masukkan tidak cocok dengan data kami.',
'password' => 'Kata sandi yang Anda masukkan salah.',
'throttle' => 'Terlalu banyak percobaan masuk. Silakan coba lagi dalam :seconds detik.',
];

22
lang/id/passwords.php Normal file
View File

@ -0,0 +1,22 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'reset' => 'Kata sandi Anda telah berhasil disetel ulang.',
'sent' => 'Kami telah mengirimkan tautan setel ulang kata sandi ke email Anda.',
'throttled' => 'Harap tunggu sebelum mencoba kembali.',
'token' => 'Token setel ulang kata sandi ini tidak valid.',
'user' => 'Kami tidak dapat menemukan pengguna dengan alamat email tersebut.',
];

Some files were not shown because too many files have changed in this diff Show More