Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permudah setup impor data awal #58

Merged
merged 5 commits into from
Nov 29, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ APP_KEY=base64:rN3vXWFRHDKFP2sMySe9f4gna7WulisoXTqn7Yo4Ye8=
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://demo.opendk.my.id/
KD_DEFAULT_PROFIL=11.05.07

DB_CONNECTION=mysql
DB_HOST=localhost
Expand Down Expand Up @@ -33,4 +32,49 @@ PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

#Arongan : 11.05.07
# KD ID KECAMATAN
KD_DEFAULT_PROFIL=11.05.07

# Profil
PROFIL_ALAMAT='Jl. Koperasi No. 1, Kab Lombok Barat, Provinsi Nusa Tenggara Barat'
PROFIL_KODE_POS='83653'
PROFIL_TELEPON='021-2345234'
PROFIL_EMAIL='[email protected]'
PROFIL_TAHUN_PEMBENTUKAN=1990
PROFIL_DASAR_PEMBENTUKAN='PEREGUB No 4 1990'
PROFIL_NAMA_CAMAT='H. Hadi Fathurrahman, S.Sos, M.AP'
PROFIL_SEKRETARIS_CAMAT='Drs. Zaenal Abidin'
PROFIL_PEMERINTAH_UMUM='Musyayad, S.Sos'
PROFIL_KESEJAHTERAAN_MASYARAKAT='Suhartono, S.Sos'
PROFIL_PEMBERDAYAAN_MASYARAKAT='Asrarudin, SE'
PROFIL_KEPSEK_PELAYAN_UMUM='Masturi, ST'
PROFIL_KEPSEK_TRANTIB='Mastur Idris, SH'
PROFIL_FILE_STRUKTUR_ORGANISASI='Lighthouse.jpg'
PROFIL_FILE_LOGO=NULL
PROFIL_VISI=NULL
PROFIL_MISI=NULL

# Data Umum
DATA_UMUM_PROFIL_ID=1
DATA_UMUM_TIPOLOGI='Kecamatan maju namun terpencil.'
DATA_UMUM_KETINGGIAN=1
DATA_UMUM_LUAS_WILAYAH=0.0
DATA_UMUM_BTS_WIL_UTARA='Kecamatan A'
DATA_UMUM_BTS_WIL_TIMUR='Kecamatan B'
DATA_UMUM_BTS_WIL_SELATAN='Kecamatan C'
DATA_UMUM_BTS_WIL_BARAT='Kecamatan D'
DATA_UMUM_JML_PUSKESMAS=0
DATA_UMUM_JML_PUSKESMAS_PEMBANTU=0
DATA_UMUM_JML_POSYANDU=0
DATA_UMUM_JML_PONDOK_BERSALIN=0
DATA_UMUM_JML_PAUD=0
DATA_UMUM_JML_SD=0
DATA_UMUM_JML_SMP=0
DATA_UMUM_JML_SMA=0
DATA_UMUM_JML_MASJID_BESAR=0
DATA_UMUM_JML_MUSHOLA=0
DATA_UMUM_JML_GEREJA=0
DATA_UMUM_JML_PASAR=0
DATA_UMUM_JML_BALAI_PERTEMUAN=0
DATA_UMUM_JML_PENDUDUK=0
DATA_UMUM_EMBED_PETA='https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d127672.75772082225!2d100.61093321349074!3d-0.27103862950004254!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x2e2ab5bbf8396485%3A0x56587edf579fe503!2sLuak%2C+Kabupaten+Lima+Puluh+Kota%2C+Sumatera+Barat!5e0!3m2!1sid!2sid!4v1557908807791!5m2!1sid!2sid'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mungkin bagian ini bisa di setting di dashboard sja, untuk data awalnya cukup isi data yg penting (seperti kecamatan_id, kabupaten_id, provinsi_id, desa_id yg mmang harus sesuai dgn KD_DEFAULT_PROFIL) dan lainnya beri nilai default agar pengguna tdk terlalu banyak mengubah pd codingannya.

Jd panduan perlu diperbaiki mengenai instalasi awal OpenDK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bung @agungsugiarto, saya setuju dengan bung @afa28 . Sebaiknya data profil dan data umum diisi oleh petugas melalui aplikasi dan tidak pada konfigurasi. Sebaiknya isi .env dan seeder dibatasi pada setting yg memang harus ada. Kita ingin proses persiapan memasang OpenDK dibuat semudah mungkin, tanpa perlu terlalu banyak mengutak-atik setting konfigurasi.

69 changes: 68 additions & 1 deletion app/Models/Wilayah.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,74 @@

class Wilayah extends Model
{
public $table = 'ref_wilayah';
/** @var string konstan panjang kode */
const PROVINSI = 2;
const KABUPATEN = 5;
const KECAMATAN = 8;
const DESA = 13;

protected $primaryKey = 'kode';

protected $keyType = 'string';

public $incrementing = false;

public $table = 'ref_wilayah';

protected $fillable = ['kode', 'nama', 'tahun'];

/**
* Scope query untuk menampilkan hanya provinsi.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeProvinsi($query)
{
return $query->whereRaw(sprintf('LENGTH(kode) = %s', static::PROVINSI));
}

/**
* Scope query untuk menampilkan hanya kabupaten.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeKabupaten($query)
{
return $query->whereRaw(sprintf('LENGTH(kode) = %s', static::KABUPATEN));
}

/**
* Scope query untuk menampilkan hanya kecamatan.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeKecamatan($query)
{
return $query->whereRaw(sprintf('LENGTH(kode) = %s', static::KECAMATAN));
}

/**
* Scope query untuk menampilkan hanya desa.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeDesa($query)
{
return $query->whereRaw(sprintf('LENGTH(kode) = %s', static::DESA));
}

/**
* Scope query untuk menampilkan desa berdaskan id kecamatan.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeGetDesaByKecamatan($query, $kecamatan_id)
{
return $query->where('kode', 'LIKE', "%{$kecamatan_id}%");
}
}
Loading