Commit b7766e3b by irul

1st commit

0 parents
# Base package for Integrasi Reklame
Untuk digunakan oleh internal OpenSIPKD.
[irul – irul.sylva@gmail.com]
{
"name": "irul/integrasi-reklame",
"description": "Base package for Integrasi Reklame",
"type": "project",
"keywords": ["opensipkd", "integrasi", "reklame"],
"time": "2019-09-01",
"license": "BSD-4-Clause",
"require": {
"php": ">=5.6.4",
"fguillot/json-rpc": "~1.2.8",
"nesbot/carbon": "~1.29.2",
"illuminate/database": "~5.4.36",
"illuminate/events": "~5.4.36",
"illuminate/validation": "~5.4.36"
},
"authors": [{
"name": "irul",
"email": "irul.sylva@gmail.com",
"homepage": "https://iruwl.github.io"
}],
"autoload": {
"psr-4": {
"Integrasi\\Reklame\\": "src/"
}
}
}
\ No newline at end of file \ No newline at end of file
<?php
/**
* @Author: irul
* @Date: 2019-09-27 20:55:56
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:21
*/
namespace Integrasi\Reklame\Base;
class AbstractClass
{
/**
* get current namespace
* ref: https://stackoverflow.com/a/6776525
*/
protected static function getParentNamespace()
{
$currentClass = get_called_class(); // call on static
$reflection = new \ReflectionClass($currentClass);
return $reflection->getNamespaceName();
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-21 00:45:29
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:45:02
*/
namespace Integrasi\Reklame\Base;
use \Integrasi\Reklame\Helper\DateFn;
use \Illuminate\Database\Capsule\Manager as DB;
/**
* Class Helper digunakan untuk mendefinisikan fungsi-fungsi
* yang sering digunakan oleh Class yang lain.
*/
class Helper extends AbstractClass
{
/**
* Fungsi untuk menambah/mengupdate OP.
* Diletakan di sini (di class Reklame bukan di class CustomerUsaha)
* karena tidak untuk konsumsi publik.
*/
public static function updateOrCreateCustomerUsaha($payload)
{
$op = null;
/**
* Update data OP jika sudah ada, Create jika belum ada.
*/
$op = call_user_func(self::getParentNamespace() . '\Models\CustomerUsaha::updateOrCreate',
array(
'customer_id' => $payload['customer_id'],
'def_pajak_id' => $payload['def_pajak_id'],
'usaha_id' => $payload['usaha_id'],
),
array(
'so' => strtoupper($payload['so']),
'reg_date' => date('Y-m-d H:i:s', strtotime($payload['reg_date'])),
'opnm' => $payload['opnm'],
'opalamat' => $payload['opalamat'],
'kelurahan_id' => $payload['kelurahan_id'],
'kecamatan_id' => $payload['kecamatan_id'],
'customer_status_id' => 1,
'enabled' => 1,
)
);
if ($op) {
return call_user_func(self::getParentNamespace() . '\Models\CustomerUsaha::find', $op->id);
}
return null;
}
/**
* Fungsi untuk mengecek table sptpd.
* Kalo ada table sptpd disimpulkan 1 SKPD dengan beberapa titik reklame
*/
public static function sptpdExist()
{
try {
$cnt = DB::table('pad_sptpd')->count();
} catch (\PDOException $e) {
return false;
}
return true;
}
/**
* Fungsi untuk mengecek penetapan.
* @param mixed $iprId IPR Id dari perizinan
* @return boolean]
*/
public static function skpdAssigned($iprId)
{
if (!self::sptpdExist()) {
$skpd = DB::table('pad_kohir')
->join('pad_spt', 'pad_spt.id', '=', 'pad_kohir.spt_id')
->where('pad_spt.r_iprid', $iprId)
->first();
if ($skpd) {
return true;
}
} else {
$skpd = DB::table('pad_kohir')
->join('pad_sptpd', 'pad_sptpd.id', '=', 'pad_kohir.sptpd_id')
->where('pad_sptpd.r_iprid', $iprId)
->first();
if ($skpd) {
return true;
}
}
return false;
}
/**
* Fungsi untuk mengecek pembayaran.
* @param mixed $iprId IPR Id dari perizinan
* @return boolean]
*/
public static function sspdAssigned($iprId)
{
if (!self::sptpdExist()) {
$sspd = DB::table('pad_sspd')
->join('pad_spt', 'pad_spt.id', '=', 'pad_sspd.spt_id')
->where('pad_spt.r_iprid', $iprId)
->where('pad_sspd.is_valid', 1)
->first();
if ($sspd) {
return true;
}
} else {
$sspd = DB::table('pad_sspd')
->join('pad_spt', 'pad_spt.id', '=', 'pad_sspd.spt_id')
->join('pad_sptpd', 'pad_sptpd.id', '=', 'pad_spt.sptpd_id')
->where('pad_sptpd.r_iprid', $iprId)
->where('pad_sspd.is_valid', 1)
->first();
if ($sspd) {
return true;
}
}
return false;
}
/**
* Mendapatkan informasi SKPD dan SSPD menggunakan key IPR ID.
*/
public static function sudahAdaSkpdAtauSspd($iprId, &$data)
{
if (self::skpdAssigned($iprId) || self::sspdAssigned($iprId)) {
$data = self::getPendataanByIprId($iprId);
return true;
}
return false;
}
/**
* Fungsi untuk mendapatkan data spd/sptpd berdasarkan ID.
* @param mixed $iprId IPR Id dari perizinan
* @return record
*/
public static function getPendataanById($id)
{
if (self::sptpdExist()) {
return call_user_func(self::getParentNamespace() . '\Models\Sptpd::with', 'customer', 'kohir', 'spt.sspd')
->whereId($id)
->first();
} else {
return call_user_func(self::getParentNamespace() . '\Models\Spt::with', 'customer', 'kohir', 'sspd')
->whereId($id)
->first();
}
}
/**
* Fungsi untuk mendapatkan data spd/sptpd berdasarkan ipr id.
* @param mixed $iprId IPR Id dari perizinan
* @return record
*/
public static function getPendataanByIprId($iprId)
{
if (self::sptpdExist()) {
return call_user_func(self::getParentNamespace() . '\Models\Sptpd::with', 'customer', 'kohir', 'spt.sspd')
->where('r_iprid', $iprId)
->first();
} else {
return call_user_func(self::getParentNamespace() . '\Models\Spt::with', 'customer', 'kohir', 'sspd')
->where('r_iprid', $iprId)
->first();
}
}
/**
* Fungsi untuk mendapatkan data spd/sptpd berdasarkan Nomor Bayar.
* @param mixed $iprId IPR Id dari perizinan
* @return record
*/
public static function getPendataanByInvoiceNumber($invoiceNumber)
{
if (self::sptpdExist()) {
$spt = call_user_func(self::getParentNamespace() . '\Models\Spt::findBySptno', $invoiceNumber)
->first();
if (!$spt) {
return null;
}
return self::getPendataanById($spt->sptpd_id);
} else {
return call_user_func(self::getParentNamespace() . '\Models\Spt::with', 'customer', 'kohir', 'sspd')
->findBySptno($invoiceNumber)
->first();
}
}
public static function pajakInfo($data)
{
if (self::sptpdExist()) {
return array(
'id' => $data->id,
'ipr_id' => $data->r_iprid,
'ipr_no' => $data->r_iprno,
'ipr_tgl' => date('Y-m-d', strtotime($data->r_iprtgl)),
'npwpd' => $data->customer->npwpd,
'wp_nama' => $data->customer->customernm,
'no_bayar' => $data->spt ? $data->spt->sptno : null,
'no_skpd' => $data->kohir ? $data->kohir->kohirno : null,
'tgl_skpd' => $data->kohir ? date('Y-m-d', strtotime($data->kohir->kohirtgl)) : null,
'nominal' => $data->spt ? $data->spt->pajak_terhutang : 0,
'status_bayar' => $data->spt && $data->spt->sspd && $data->spt->sspd->is_valid == 1 ? 1 : 0,
'tgl_bayar' => $data->spt && $data->spt->sspd && $data->spt->sspd->sspdtgl ? date('Y-m-d', strtotime($data->spt->sspd->sspdtgl)) : null,
);
} else {
return array(
'id' => $data->id,
'ipr_id' => $data->r_iprid,
'ipr_no' => $data->r_iprno,
'ipr_tgl' => date('Y-m-d', strtotime($data->r_iprtgl)),
'npwpd' => $data->customer->npwpd,
'wp_nama' => $data->customer->customernm,
'no_bayar' => $data->kohir ? $data->sptno : null,
'no_skpd' => $data->kohir ? $data->kohir->kohirno : null,
'tgl_skpd' => $data->kohir ? date('Y-m-d', strtotime($data->kohir->kohirtgl)) : null,
'nominal' => $data->kohir ? $data->pajak_terhutang : 0,
'status_bayar' => $data->sspd && $data->sspd->is_valid == 1 ? 1 : 0,
'tgl_bayar' => $data->sspd && $data->sspd->sspdtgl ? date('Y-m-d', strtotime($data->sspd->sspdtgl)) : null,
);
}
}
// ===================================================================== //
/**
* Fungsi untuk mendapatkan jumlah toleransi hari antara dua tanggal
* yang mana dalam satu bulan dibulatkan menjadi 30 hari.
* @param date $dateStart Tanggal awal
* @param date $dateEnd Tanggal akhir
* @return int
*/
public static function toleransiHari($dateStart, $dateEnd)
{
$FIXED_DAYS = 30;
$yearStart = date('Y', strtotime($dateStart));
$yearEnd = date('Y', strtotime($dateEnd));
$monthStart = date('m', strtotime($dateStart));
$monthEnd = (12 * ($yearEnd - $yearStart)) + date('m', strtotime($dateEnd));
$countDays = 0;
for ($i = $monthStart; $i < $monthEnd; $i++) {
$_month = ($i % 12);
$_year = floor($yearStart + ($i / 12));
$countDays += DateFn::daysInMonth($_month, $_year);
}
$totalMonths = DateFn::monthDiff($dateStart, $dateEnd);
$totalFixedDays = $totalMonths * $FIXED_DAYS;
$toleransi = $countDays - $totalFixedDays;
return $toleransi < 0 ? 0 : $toleransi;
}
/**
* Fungsi untuk mendapatkan jumlah termin berdasarkan tanggal masa
* dan masapajak terpilih.
* @param date $dateStart Tanggal awal
* @param date $dateEnd Tanggal akhir
* @param int $masaPajak Masapajak
* @return int
*/
public static function hitungTermin($dateStart, $dateEnd, $masaPajak)
{
$toleransiHari = self::toleransiHari($dateStart, $dateEnd);
$selisihHari = DateFn::dayDiff($dateStart, $dateEnd) + 1;
switch ($masaPajak) {
/* tahunan */
case 1:
$jumlahHari = 360;
$termin = intval($selisihHari / $jumlahHari) ?: 1;
$selisihHari = $selisihHari - ($termin * $jumlahHari);
if ($selisihHari > $toleransiHari) {
$termin++;
}
break;
/* semesteran */
case 2:
$jumlahHari = 180;
$termin = intval($selisihHari / $jumlahHari) ?: 1;
$selisihHari = $selisihHari - ($termin * $jumlahHari);
if ($selisihHari > $toleransiHari) {
$termin++;
}
break;
/* triwulanan */
case 3:
$jumlahHari = 90;
$termin = intval($selisihHari / $jumlahHari) ?: 1;
$selisihHari = $selisihHari - ($termin * $jumlahHari);
if ($selisihHari > $toleransiHari) {
$termin++;
}
break;
/* bulanan */
case 4:
$jumlahHari = 30;
$termin = intval($selisihHari / $jumlahHari) ?: 1;
$selisihHari = $selisihHari - ($termin * $jumlahHari);
if ($selisihHari > $toleransiHari) {
$termin++;
}
break;
/* mingguan */
case 5:
$jumlahHari = 7;
$termin = intval($selisihHari / $jumlahHari) ?: 1;
$selisihHari = $selisihHari - ($termin * $jumlahHari);
if ($selisihHari > $toleransiHari) {
$termin++;
}
break;
/* harian */
case 6:
$termin = $selisihHari;
break;
}
return $termin;
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 19:56:00
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base;
/**
* Daftar method (global) yang digunakan untuk semua daerah.
*/
class Methods extends AbstractClass
{
public function doSomething($arg1, $arg2 = 3)
{
return $arg1 + $arg2;
}
// == REKLAME == //
public function setIpr($payload)
{
// return Reklame::setIpr($payload);
return call_user_func(self::getParentNamespace() . '\Reklame::setIpr', $payload);
}
public function getReklameById($id)
{
// return Reklame::getById($id);
return call_user_func(self::getParentNamespace() . '\Reklame::getById', $id);
}
public function getReklameByIprId($ipr_id)
{
// return Reklame::getByIprId($ipr_id);
return call_user_func(self::getParentNamespace() . '\Reklame::getByIprId', $ipr_id);
}
public function getReklameByInvoiceNumber($invoice_number)
{
// return Reklame::getByInvoiceNumber($invoice_number);
return call_user_func(self::getParentNamespace() . '\Reklame::getByInvoiceNumber', $invoice_number);
}
// == WP == //
public function createWajibPajak($payload)
{
// return WajibPajak::create($payload);
return call_user_func(self::getParentNamespace() . '\WajibPajak::create', $payload);
}
public function getWajibPajakByNpwpd($npwpd)
{
// return WajibPajak::getByNpwpd($npwpd);
return call_user_func(self::getParentNamespace() . '\WajibPajak::getByNpwpd', $npwpd);
}
public function getWajibPajakBySkpd($skpdno)
{
// return WajibPajak::getBySkpd($skpdno);
return call_user_func(self::getParentNamespace() . '\WajibPajak::getBySkpd', $skpdno);
}
public function getWajibPajakById($id)
{
// return WajibPajak::getById($id);
return call_user_func(self::getParentNamespace() . '\WajibPajak::getById', $id);
}
// == OP == //
// NOTE: Mungkin akan disable saja
public function getObjekPajakById($id)
{
// return ObjekPajak::getById($id);
return call_user_func(self::getParentNamespace() . '\ObjekPajak::getById', $id);
}
// == REFERENSI == //
public function getKecamatan()
{
// return Referensi::getKecamatan();
return call_user_func(self::getParentNamespace() . '\Referensi::getKecamatan');
}
public function getKecamatanById($id)
{
// return Referensi::getKecamatanById($id);
return call_user_func(self::getParentNamespace() . '\Referensi::getKecamatanById', $id);
}
public function getKelurahan()
{
// return Referensi::getKelurahan();
return call_user_func(self::getParentNamespace() . '\Referensi::getKelurahan');
}
public function getKelurahanById($id)
{
// return Referensi::getKelurahanById($id);
return call_user_func(self::getParentNamespace() . '\Referensi::getKelurahanById', $id);
}
public function getKelurahanByKecamatanId($kecamatan_id)
{
// return Referensi::getKelurahanByKecamatanId($kecamatan_id);
return call_user_func(self::getParentNamespace() . '\Referensi::getKelurahanByKecamatanId', $kecamatan_id);
}
public function getPajakReklame()
{
// return Referensi::getPajakReklame();
return call_user_func(self::getParentNamespace() . '\Referensi::getPajakReklame');
}
public function getPajakReklameById($id)
{
// return Referensi::getPajakReklameById($id);
return call_user_func(self::getParentNamespace() . '\Referensi::getPajakReklameById', $id);
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-27 20:55:56
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
use \Illuminate\Database\Eloquent\Model;
class AbstractModel extends Model
{
const CREATED_AT = 'create_date';
const UPDATED_AT = 'write_date';
/**
* get current namespace
* ref: https://stackoverflow.com/a/6776525
*/
protected function getParentNamespace()
{
$currentClass = get_class($this);
$reflection = new \ReflectionClass($currentClass);
return $reflection->getNamespaceName();
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 20:33:14
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
use \Illuminate\Database\Capsule\Manager as DB;
class Customer extends AbstractModel
{
protected $table = 'pad_customer';
protected $visible = array(
'id',
'npwpd',
'rp',
'pb',
'reg_date',
'customernm',
// 'kecamatan_id',
'kecamatan',
// 'kelurahan_id',
'kelurahan',
'kabupaten',
'alamat',
'kodepos',
'telphone',
'wpnama',
'wpalamat',
'wpkelurahan',
'wpkecamatan',
'wpkabupaten',
'wptelp',
'wpkodepos',
);
protected $appends = array(
'kecamatan',
'kelurahan',
);
protected $guarded = array();
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
return $model->_onCreating($model);
});
}
public function _onCreating($attr)
{
/**
* Increment formno.
*/
// $maxFormno = Customer::select(DB::raw('max(formno) as nomor'))
$maxFormno = call_user_func($this->getParentNamespace() . '\Customer::select',
DB::raw('max(formno) as nomor'))
->where(DB::raw('rp'), trim($this->attributes['rp']))
->first();
$formno = ($maxFormno->nomor ?: 0) + 1;
$this->attributes['formno'] = $formno;
$this->attributes['create_uid'] = \Api\AuthBasic::getUid();
/**
* Get kecamatannm
*/
// $attr->wpkecamatan = trim(Kecamatan::find($attr->wpkecamatan_id)->kecamatannm);
$attr->wpkecamatan = trim(call_user_func($this->getParentNamespace() . '\Kecamatan::find',
$attr->wpkecamatan_id)->kecamatannm);
/**
* Get kelurahannm
*/
// $attr->wpkelurahan = trim(Kelurahan::find($attr->wpkelurahan_id)->kelurahannm);
$attr->wpkelurahan = trim(call_user_func($this->getParentNamespace() . '\Kelurahan::find',
$attr->wpkelurahan_id)->kelurahannm);
/**
* Unset wpkecamatan_id dan wpkelurahan_id
* karena tidak ada fieldnya pada table pad_customer
*/
unset($attr->wpkecamatan_id);
unset($attr->wpkelurahan_id);
return true;
}
// == ACCESSORS == //
public function getNpwpdAttribute($value)
{
// return strtolower($value);
$qry = "select get_npwpd(?, false) as npwpd";
$row = DB::select(DB::raw($qry), array($this->attributes['id']));
return $row[0]->npwpd;
}
public function getKecamatanAttribute($value)
{
// $row = Kecamatan::find($this->attributes['kecamatan_id']);
$row = call_user_func($this->getParentNamespace() . '\Kecamatan::find',
$this->attributes['kecamatan_id']);
return $row->kecamatannm;
}
public function getKelurahanAttribute($value)
{
// $row = Kelurahan::find($this->attributes['kelurahan_id']);
$row = call_user_func($this->getParentNamespace() . '\Kelurahan::find',
$this->attributes['kelurahan_id']);
return $row->kelurahannm;
}
// == QUERY SCOPES == //
public function scopeFindByNpwpd($query, $npwpd)
{
// $data = Customer::where(DB::raw('get_npwpd(id, false)'), array($npwpd))->toSql();
// print_r($data); die();
return $query->where(DB::raw('get_npwpd(id, false)'), array($npwpd));
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 21:39:58
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
use \Illuminate\Database\Capsule\Manager as DB;
class CustomerUsaha extends AbstractModel
{
protected $table = 'pad_customer_usaha';
protected $visible = array(
'id',
'customer_id',
'usaha_id',
'konterid',
'reg_date',
'kecamatan_id',
'kelurahan_id',
'opnm',
'opalamat',
'pnama',
'palamat',
'pkelurahan',
'pkecamatan',
'pkabupaten',
'ptelp',
'pkodepos',
'nopd',
);
protected $appends = array('nopd');
protected $guarded = array();
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
return $model->_onCreating();
});
}
public function _onCreating()
{
// $maxKonterid = CustomerUsaha::select(DB::raw('max(konterid) as nomor'))
$maxKonterid = call_user_func($this->getParentNamespace() . '\CustomerUsaha::select',
DB::raw('max(konterid) as nomor'))
->where(DB::raw('customer_id'), trim($this->attributes['customer_id']))
->first();
// ->toSql();
$konterid = ($maxKonterid->nomor ?: 0) + 1;
$this->attributes['konterid'] = $konterid;
$this->attributes['create_uid'] = \Api\AuthBasic::getUid();
return true;
}
// == ACCESSORS == //
public function getNopdAttribute($value)
{
$qry = "select get_nopd(?, false) as nopd";
$row = DB::select(DB::raw($qry), array($this->attributes['id']));
return $row[0]->nopd;
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 20:35:48
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
class Kecamatan extends AbstractModel
{
protected $table = 'tblkecamatan';
protected $visible = array('id', 'kecamatannm');
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 19:12:20
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
class Kelurahan extends AbstractModel
{
protected $table = 'tblkelurahan';
protected $visible = array('id', 'kecamatan_id', 'kelurahannm');
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 23:11:56
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
use \Integrasi\Reklame\Base\Helper;
use \Illuminate\Database\Capsule\Manager as DB;
class Kohir extends AbstractModel
{
protected $table = 'pad_kohir';
// == ACCESSORS == //
public function getKohirnoAttribute($value)
{
if (!Helper::sptpdExist()) {
$qry = "select get_kohirno(?) as kohirno";
$row = DB::select(DB::raw($qry), array($this->attributes['spt_id']));
return $row[0]->kohirno;
} else {
$qry = "select get_kohirno(?) as kohirno";
$row = DB::select(DB::raw($qry), array($this->attributes['sptpd_id']));
return $row[0]->kohirno;
}
}
// == RELATIONSHIPS == //
/**
* Get the spt that owns the kohir/skpd.
*/
public function spt()
{
if (!Helper::sptpdExist()) {
return $this->belongsTo($this->getParentNamespace() . '\Spt', 'id', 'spt_id');
}
return null;
}
/**
* Get the sptpd that owns the kohir/skpd.
*/
public function sptpd()
{
if (Helper::sptpdExist()) {
return $this->belongsTo($this->getParentNamespace() . '\Sptpd', 'id', 'sptpd_id');
}
return null;
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 23:30:29
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
class Pajak extends AbstractModel
{
protected $table = 'pad_pajak';
protected $visible = array('id', 'pajaknm', 'tarif', 'latestTarif');
// == RELATIONSHIPS == //
/**
* Get the tarif record associated with the pajak.
*/
public function tarif()
{
return $this->hasMany($this->getParentNamespace() . '\PajakTarif');
}
/**
* Get the latest tarif record associated with the pajak.
*/
public function latestTarif()
{
return $this->hasOne($this->getParentNamespace() . '\PajakTarif')
->whereEnabled(1)
->latest(self::CREATED_AT);
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 19:12:18
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
class PajakTarif extends AbstractModel
{
protected $table = 'pad_pajak_tarif';
protected $visible = array('id', 'pajak_id', 'tarif', 'reklame', 'minomset');
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 22:59:27
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base\Models;
class Queue extends AbstractModel
{
protected $table = 'ipr_queue';
protected $guarded = array();
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 13:41:14
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:21
*/
namespace Integrasi\Reklame\Base\Models;
use \Illuminate\Database\Capsule\Manager as DB;
class Spt extends AbstractModel
{
protected $table = 'pad_spt';
protected $guarded = array();
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
return $model->_onCreating();
});
}
public function _onCreating()
{
// $maxSptno = Spt::select(DB::raw('max(sptno) as nomor'))
$maxSptno = call_user_func($this->getParentNamespace() . '\Spt::select',
DB::raw('max(sptno) as nomor'))
->where(DB::raw('tahun'), date('Y', strtotime($this->attributes['terimatgl'])))
->first();
$sptno = ($maxSptno->nomor ?: 0) + 1;
$this->attributes['sptno'] = $sptno;
$this->attributes['create_uid'] = \Api\AuthBasic::getUid();
return true;
}
// == ACCESSORS == //
public function getSptnoAttribute($value)
{
$qry = "select get_sptno(?) as sptno";
$row = DB::select(DB::raw($qry), array($this->attributes['id']));
return $row[0]->sptno;
}
// == QUERY SCOPES == //
public static function scopeFindBySptno($query, $sptno)
{
return $query->where(DB::raw('get_sptno(id)'), array($sptno));
}
public static function scopeFindByKohirno($query, $kohirno)
{
return $query->where(DB::raw('get_kohirno(id)'), array($kohirno));
}
// == RELATIONSHIPS == //
/**
* Get the customer that owns the spt.
*/
public function customer()
{
return $this->belongsTo($this->getParentNamespace() . '\Customer');
}
/**
* Get the kohir record associated with the spt.
*/
public function kohir()
{
if (!Helper::sptpdExist()) {
return $this->hasOne($this->getParentNamespace() . '\Kohir');
}
return null;
}
/**
* Get the sspd record associated with the spt.
*/
public function sspd()
{
return $this->hasOne($this->getParentNamespace() . '\Sspd');
}
/**
* Get the sptpd that owns the spt.
*/
public function sptpd()
{
if (Helper::sptpdExist()) {
return $this->belongsTo($this->getParentNamespace() . '\Sptpd');
}
return null;
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 15:28:04
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:21
*/
namespace Integrasi\Reklame\Base\Models;
use \Illuminate\Database\Capsule\Manager as DB;
class Sptpd extends AbstractModel
{
protected $table = 'pad_sptpd';
// protected $visible = array(
// 'id',
// 'sptno',
// 'customer_id',
// 'customer_usaha_id',
// 'pajak_id',
// 'tahun',
// 'terimatgl',
// 'type_id',
// 'so',
// 'jatuhtempotgl',
// 'masadari',
// 'masasd',
// 'minomset',
// 'dasar',
// 'tarif',
// 'denda',
// 'bunga',
// 'setoran',
// 'kenaikan',
// 'kompensasi',
// 'lain2',
// 'pajak_terhutang',
// 'r_bayarid',
// 'rekening_id',
// 'create_date',
// 'create_uid',
// 'enabled',
// 'spt',
// 'customer',
// 'kohir',
// 'rincianReklame',
// );
protected $guarded = array();
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
return $model->_onCreating();
});
}
public function _onCreating()
{
$maxSptno = call_user_func($this->getParentNamespace() . '\Sptpd::select',
DB::raw('max(sptno) as nomor'))
->where(DB::raw('tahun'), date('Y', strtotime($this->attributes['terimatgl'])))
->first();
$sptno = ($maxSptno->nomor ?: 0) + 1;
$this->attributes['sptno'] = $sptno;
$this->attributes['create_uid'] = \Api\AuthBasic::getUid();
return true;
}
// == ACCESSORS == //
public function getSptpdnoAttribute($value)
{
$qry = "select get_sptpdno(?) as sptno";
$row = DB::select(DB::raw($qry), array($this->attributes['id']));
return $row[0]->sptno;
}
// == QUERY SCOPES == //
public static function scopeFindBySptpdno($query, $sptno)
{
return $query->where(DB::raw('get_sptpdno(id)'), array($sptno));
}
public static function scopeFindByKohirno($query, $kohirno)
{
return $query->where(DB::raw('get_kohirno(id)'), array($kohirno));
}
// == RELATIONSHIPS == //
/**
* Get the customer that owns the sptpd.
*/
public function customer()
{
return $this->belongsTo($this->getParentNamespace() . '\Customer');
}
/**
* Get the spt record associated with the sptpd.
*/
public function spt()
{
return $this->hasOne($this->getParentNamespace() . '\Spt');
}
/**
* Get the kohir record associated with the sptpd.
*/
public function kohir()
{
return $this->hasOne($this->getParentNamespace() . '\Kohir');
}
/**
* Get the rincian reklame record associated with the sptpd.
*/
public function rincianReklame()
{
return $this->hasMany($this->getParentNamespace() . '\SptpdRincianReklame', 'sptpd_id', 'id');
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 15:29:45
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:21
*/
namespace Integrasi\Reklame\Base\Models;
use \Illuminate\Database\Capsule\Manager as DB;
class SptpdRincianReklame extends AbstractModel
{
protected $table = 'pad_sptpd_rk_det';
protected $guarded = array();
public $timestamps = false;
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
return $model->_onCreating();
});
}
public function _onCreating()
{
$maxReklameKe = call_user_func($this->getParentNamespace() . '\SptpdRincianReklame::select',
DB::raw('max(reklame_ke) as nomor'))
->where(DB::raw('sptpd_id'), $this->attributes['sptpd_id'])
->first();
$reklameKe = ($maxReklameKe->nomor ?: 0) + 1;
$this->attributes['reklame_ke'] = $reklameKe;
return true;
}
// == RELATIONSHIPS == //
/**
* Get the sptpd that owns the sptpd_rincian_reklame.
*/
public function sptpd()
{
return $this->belongsTo($this->getParentNamespace() . '\Sptpd', 'id', 'sptpd_id');
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 22:59:14
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:21
*/
namespace Integrasi\Reklame\Base\Models;
use \Illuminate\Database\Capsule\Manager as DB;
class Sspd extends AbstractModel
{
protected $table = 'pad_sspd';
public $timestamps = false;
// == ACCESSORS == //
public function getSspdnoAttribute($value)
{
$qry = "select get_sspdno(?) as sspdno";
$row = DB::select(DB::raw($qry), array($this->attributes['spt_id']));
return $row[0]->sspdno;
}
public function getSspdtglAttribute()
{
return date('Y-m-d H:i:s', strtotime($this->attributes['sspdtgl']));
}
public function getCreateDateAttribute()
{
return date('Y-m-d H:i:s', strtotime($this->attributes['create_date']));
}
public function getWriteDateAttribute()
{
return date('Y-m-d H:i:s', strtotime($this->attributes['write_date']));
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 22:59:27
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:21
*/
namespace Integrasi\Reklame\Base\Models;
class User extends AbstractModel
{
protected $table = 'app.users';
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 23:04:26
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:54
*/
namespace Integrasi\Reklame\Base;
use \Illuminate\Database\Eloquent\ModelNotFoundException;
class ObjekPajak extends AbstractClass
{
// /**
// * Konsumsi publik, sementara disabled aja, belum diperlukan.
// */
// public function updateOrCreate($payload)
// {
// /**
// * Pengaturan validasi payload.
// */
// $rules = array(
// 'customer_id' => 'required|exists:pad_customer,id',
// 'def_pajak_id' => 'required|exists:pad_pajak,id',
// 'usaha_id' => 'required|exists:pad_usaha,id',
// 'reg_date' => 'required|date',
// 'so' => 'required|in:S,O',
// 'opnm' => 'required|max:100',
// 'opalamat' => 'required|max:250',
// 'kelurahan_id' => 'required|exists:tblkelurahan,id',
// 'kecamatan_id' => 'required|exists:tblkecamatan,id',
// );
// /**
// * Proses validasi payload.
// */
// $validation = Validator::make($payload, $rules);
// if ($validation->fails()) {
// throw new ResponseException('Parameter yang dikirim tidak lulus proses validasi.',
// 0,
// null,
// $validation->messages());
// }
// /**
// * Update data OP jika sudah ada, Create jika belum ada.
// */
// // $op = Models\CustomerUsaha::updateOrCreate(
// $op = call_user_func(self::getParentNamespace() . '\Models\CustomerUsaha::updateOrCreate',
// array(
// 'customer_id' => $payload['customer_id'],
// 'def_pajak_id' => $payload['def_pajak_id'],
// 'usaha_id' => $payload['usaha_id'],
// ),
// array(
// 'reg_date' => date('Y-m-d H:i:s', strtotime($payload['reg_date'])),
// 'so' => $payload['so'],
// 'opnm' => $payload['opnm'],
// 'opalamat' => $payload['opalamat'],
// 'kecamatan_id' => $payload['kecamatan_id'],
// 'kelurahan_id' => $payload['kelurahan_id'],
// 'customer_status_id' => 1,
// 'enabled' => 1,
// )
// );
// return self::getById($op->id);
// }
public static function getById($id)
{
// $data = Models\CustomerUsaha::find($id);
$data = call_user_func(self::getParentNamespace() . '\Models\CustomerUsaha::find', $id);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 23:05:52
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base;
use \Illuminate\Database\Eloquent\ModelNotFoundException;
/**
* Daftar method (global) yang digunakan untuk semua daerah.
* Pengelompokan berdasarkan data pendukung.
*/
class Referensi extends AbstractClass
{
public static function getKecamatan()
{
// return Models\Kecamatan::all()->toJson();
// $data = Models\Kecamatan::where('enabled', 1)->get();
// $data = Models\Kecamatan::whereEnabled(1)->get();
$data = call_user_func(self::getParentNamespace() . '\Models\Kecamatan::whereEnabled', 1)
->get();
if (!count($data)) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
public static function getKecamatanById($id)
{
// $data = Models\Kecamatan::whereEnabled(1)->find($id);
$data = call_user_func(self::getParentNamespace() . '\Models\Kecamatan::whereEnabled', 1)
->find($id);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
public static function getKelurahan()
{
// $data = Models\Kelurahan::whereEnabled(1)->get();
$data = call_user_func(self::getParentNamespace() . '\Models\Kelurahan::whereEnabled', 1)
->get();
if (!count($data)) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
public static function getKelurahanById($id)
{
// $data = Models\Kelurahan::whereEnabled(1)->find($id);
$data = call_user_func(self::getParentNamespace() . '\Models\Kelurahan::whereEnabled', 1)
->find($id);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
public static function getKelurahanByKecamatanId($kecamatan_id)
{
// $data = Models\Kelurahan::whereRaw('enabled = 1 and kecamatan_id = ?', array($kecamatan_id))->get();
// $data = Models\Kelurahan::whereEnabled(1)->whereKecamatan_id($kecamatan_id)->get();
$data = call_user_func(self::getParentNamespace() . '\Models\Kelurahan::whereEnabled', 1)
->whereKecamatan_id($kecamatan_id)
->get();
if (!count($data)) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
public static function getPajakReklame()
{
// $data = Models\Pajak::whereEnabled(1)->whereUsahaId(DEFAULT_USAHA_ID)->get();
$data = call_user_func(self::getParentNamespace() . '\Models\Pajak::whereEnabled', 1)
->whereUsahaId(DEFAULT_USAHA_ID)
->get();
if (!count($data)) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
public static function getPajakReklameById($id)
{
// $data = Models\Pajak::whereEnabled(1)->whereUsahaId(DEFAULT_USAHA_ID)->find($id);
$data = call_user_func(self::getParentNamespace() . '\Models\Pajak::whereEnabled', 1)
->whereUsahaId(DEFAULT_USAHA_ID)
->find($id);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 15:20:24
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:43:20
*/
namespace Integrasi\Reklame\Base;
use \Illuminate\Database\Eloquent\ModelNotFoundException;
use \JsonRPC\Exception\ServerErrorException;
/**
* Class utama yang digunakan untuk integrasi reklame.
*/
class Reklame extends AbstractClass
{
/**
* Fungsi untuk menyimpan data IPR yang dikirim dari Perizinan
* ke dalam tbl pad_sptpd.
*
* Algoritma secara umum:
* 1. Cek Pajak join PajakTarif
* 2. Get WP
* 3. Get OP (create/update)
* 4. Create SPT/SPTPD
* 5. Create Rincian (depend on)
*/
public static function setIpr($payload)
{
throw new ServerErrorException(
"Silahkan dibuat dan disesuaikan dengan kondisi yang ada disuatu wilayah");
}
// ===================================================================== //
/**
* Mendapatkan informasi reklame menggunakan key ID.
*
* ID di sini merupakan:
* - ID pada tabel pad_spt jika tidak ada table pad_sptpd.
* - ID pada tabel pad_sptpd jika ada table pad_sptpd.
*/
public static function getById($id)
{
$data = Helper::getPendataanById($id);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return Helper::pajakInfo($data);
}
/**
* Mendapatkan informasi reklame menggunakan key IPR ID.
*
* IPR ID merupkan ID unik milik perizinan yang digunakan
* sebagai key antara perizinan dengan pajak.
*/
public static function getByIprId($iprId)
{
$data = Helper::getPendataanByIprId($iprId);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return Helper::pajakInfo($data);
}
/**
* Mendapatkan informasi reklame menggunakan
* key Invoice Number (Nomor Bayar/sptno).
* Invoice Number atau biasa dikenal dengan Nomor Bayar atau Nomor SPT.
*/
public static function getByInvoiceNumber($invoiceNumber)
{
$data = Helper::getPendataanByInvoiceNumber($invoiceNumber);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return Helper::pajakInfo($data);
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 23:09:49
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:57:49
*/
namespace Integrasi\Reklame\Base;
use \Integrasi\Reklame\Helper\Validator;
use \Illuminate\Database\Eloquent\ModelNotFoundException;
use \JsonRPC\Exception\ResponseException;
class WajibPajak extends AbstractClass
{
public static function create($payload)
{
/**
* Pengaturan validasi payload.
*/
$rules = array(
'rp' => 'required|in:R,P',
'pb' => 'required|in:1,2',
'kelurahan_id' => 'required|exists:tblkelurahan,id',
'kecamatan_id' => 'required|exists:tblkecamatan,id',
'customernm' => 'required|max:150',
'kabupaten' => 'required|max:25',
'alamat' => 'required|max:255',
'kodepos' => 'required|max:5',
'telphone' => 'required|max:40',
'wpnama' => 'required|max:150',
'wpalamat' => 'required|max:255',
'wpkelurahan_id' => 'required|exists:tblkelurahan,id',
'wpkecamatan_id' => 'required|exists:tblkecamatan,id',
'wpkabupaten' => 'required|max:25',
'wpkodepos' => 'required|max:5',
'wptelp' => 'required|max:40',
);
/**
* Proses validasi payload.
*/
$validation = Validator::make($payload, $rules);
if ($validation->fails()) {
throw new ResponseException(
'Parameter yang dikirim tidak lulus proses validasi.',
0,
null,
$validation->messages());
}
// $wp = Models\Customer::create(array(
$wp = call_user_func(self::getParentNamespace() . '\Models\Customer::create', array(
'rp' => strtoupper(trim($payload['rp'])),
'pb' => $payload['pb'],
'kelurahan_id' => $payload['kelurahan_id'],
'kecamatan_id' => $payload['kecamatan_id'],
'reg_date' => date('Y-m-d H:i:s'),
'customernm' => trim($payload['customernm']),
'kabupaten' => trim($payload['kabupaten']),
'alamat' => trim($payload['alamat']),
'kodepos' => trim($payload['kodepos']),
'telphone' => trim($payload['telphone']),
'wpnama' => trim($payload['wpnama']),
'wpalamat' => trim($payload['wpalamat']),
'wpkelurahan_id' => $payload['wpkelurahan_id'],
'wpkecamatan_id' => $payload['wpkecamatan_id'],
'wpkelurahan' => 'Will be replaced in model',
'wpkecamatan' => 'Will be replaced in model',
'wpkabupaten' => trim($payload['wpkabupaten']),
'wpkodepos' => trim($payload['wpkodepos']),
'wptelp' => trim($payload['wptelp']),
'enabled' => 1,
));
return self::getById($wp->id);
}
public static function getByNpwpd($npwpd)
{
// $data = Models\Customer::findByNpwpd($npwpd)->first();
$data = call_user_func(self::getParentNamespace() . '\Models\Customer::findByNpwpd', $npwpd)->first();
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
public static function getBySkpd($kohirno)
{
if (!Helper::sptpdExist()) {
// $spt = Models\Spt::findByKohirno($kohirno)->first();
$spt = call_user_func(self::getParentNamespace() . '\Models\Spt::findByKohirno', $kohirno)->first();
if (!$spt) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return self::getById($spt->customer_id);
} else {
$sptpd = call_user_func(self::getParentNamespace() . '\Models\Sptpd::findByKohirno', $kohirno)->first();
if (!$sptpd) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return self::getById($sptpd->customer_id);
}
}
public static function getById($id)
{
// $data = Models\Customer::find($id);
$data = call_user_func(self::getParentNamespace() . '\Models\Customer::find', $id);
if (!$data) {
throw new ModelNotFoundException(MSG_NOT_FOUND);
}
return $data;
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-20 14:56:04
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:44:58
*/
namespace Integrasi\Reklame\Helper;
class DateFn
{
/**
* Fungsi untuk mendapatkan selisih bulan antara dua tanggal.
* @param date $dateStart Tanggal awal
* @param date $dateEnd Tanggal akhir
* @return int
*/
public static function monthDiff($dateStart, $dateEnd)
{
$monthStart = date('m', strtotime($dateStart));
$monthEnd = date('m', strtotime($dateEnd));
$yearStart = date('Y', strtotime($dateStart));
$yearEnd = date('Y', strtotime($dateEnd));
return $monthEnd - $monthStart + (12 * ($yearEnd - $yearStart));
}
/**
* Fungsi untuk mendapatkan jumlah hari dalam bulan dan tahun tertentu
* @param int $month Bulan
* @param int $year Tahun
* @return int
*/
public static function daysInMonth($month, $year)
{
return date('t', strtotime("$year-$month-1"));
}
/**
* Fungsi untuk mendapatkan selisih hari antara dua tanggal.
* @param date $dateStart Tanggal awal
* @param date $dateEnd Tanggal akhir
* @return int
*/
public static function dayDiff($dateStart, $dateEnd)
{
return round((strtotime($dateEnd) - strtotime($dateStart)) / (60 * 60 * 24));
}
}
<?php
/**
* @Author: irul
* @Date: 2019-09-23 00:35:43
* @Last Modified by: irul
* @Last Modified time: 2019-10-01 23:59:16
*/
/**
* @Source: https://github.com/jeffochoa/validator-factory/blob/master/src/ValidatorFactory.php
* @Reference: https://laravel.com/docs/5.4/validation#available-validation-rules
*/
namespace Integrasi\Reklame\Helper;
use \Illuminate\Filesystem\Filesystem;
use \Illuminate\Translation\FileLoader;
use \Illuminate\Translation\Translator;
use \Illuminate\Validation\Factory;
class Validator
{
public $lang;
public $group;
public $factory;
public $namespace;
public $basePath;
public static $translator;
public static $instance;
public function __construct($namespace = 'lang', $lang = 'en', $group = 'validation')
{
$this->lang = $lang;
$this->group = $group;
$this->namespace = $namespace;
$this->basePath = $this->getTranslationsRootPath();
$this->factory = new Factory($this->loadTranslator());
self::$instance = $this;
}
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
public static function factory()
{
return new Validator();
}
public function translationsRootPath($path = '')
{
if (!empty($path)) {
$this->basePath = $path;
$this->reloadValidatorFactory();
}
return $this;
}
private function reloadValidatorFactory()
{
$this->factory = new Factory($this->loadTranslator());
return $this;
}
public function getTranslationsRootPath()
{
return dirname(__FILE__) . '/';
}
public function loadTranslator()
{
$loader = new FileLoader(new Filesystem(), $this->basePath . $this->namespace);
$loader->addNamespace($this->namespace, $this->basePath . $this->namespace);
$loader->load($this->lang, $this->group, $this->namespace);
return static::$translator = new Translator($loader, $this->lang);
}
public function __call($method, $args)
{
return call_user_func_array(array($this->factory, $method), $args);
}
public static function __callStatic($method, $args)
{
return call_user_func_array(array(self::getInstance(), $method), $args);
}
}
<?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 must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'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 is 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 and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
/*
|--------------------------------------------------------------------------
| 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 attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => [],
];
<?php
return [
/*
|---------------------------------------------------------------------------------------
| Baris Bahasa untuk Validasi
|---------------------------------------------------------------------------------------
|
| Baris bahasa berikut ini berisi standar pesan kesalahan yang digunakan oleh
| kelas validasi. Beberapa aturan mempunyai multi versi seperti aturan 'size'.
| Jangan ragu untuk mengoptimalkan setiap pesan yang ada di sini.
|
*/
'accepted' => 'Isian :attribute harus diterima.',
'active_url' => 'Isian :attribute bukan URL yang valid.',
'after' => 'Isian :attribute harus tanggal setelah :date.',
'after_or_equal' => 'Isian :attribute harus berupa tanggal setelah atau sama dengan tanggal :date.',
'alpha' => 'Isian :attribute hanya boleh berisi huruf.',
'alpha_dash' => 'Isian :attribute hanya boleh berisi huruf, angka, dan strip.',
'alpha_num' => 'Isian :attribute hanya boleh berisi huruf dan angka.',
'array' => 'Isian :attribute harus berupa sebuah array.',
'before' => 'Isian :attribute harus tanggal sebelum :date.',
'before_or_equal' => 'Isian :attribute harus berupa tanggal sebelum atau sama dengan tanggal :date.',
'between' => [
'numeric' => 'Isian :attribute harus antara :min dan :max.',
'file' => 'Bidang :attribute harus antara :min dan :max kilobita.',
'string' => 'Isian :attribute harus antara :min dan :max karakter.',
'array' => 'Isian :attribute harus antara :min dan :max item.',
],
'boolean' => 'Isian :attribute harus berupa true atau false',
'confirmed' => 'Konfirmasi :attribute tidak cocok.',
'date' => 'Isian :attribute bukan tanggal yang valid.',
'date_equals' => 'The :attribute must be a date equal to :date.',
'date_format' => 'Isian :attribute tidak cocok dengan format :format.',
'different' => 'Isian :attribute dan :other harus berbeda.',
'digits' => 'Isian :attribute harus berupa angka :digits.',
'digits_between' => 'Isian :attribute harus antara angka :min dan :max.',
'dimensions' => 'Bidang :attribute tidak memiliki dimensi gambar yang valid.',
'distinct' => 'Bidang isian :attribute memiliki nilai yang duplikat.',
'email' => 'Isian :attribute harus berupa alamat surel yang valid.',
'exists' => 'Isian :attribute yang dipilih tidak valid.',
'file' => 'Bidang :attribute harus berupa sebuah berkas.',
'filled' => 'Isian :attribute harus memiliki nilai.',
'gt' => [
'numeric' => 'Isian :attribute harus lebih besar dari :value.',
'file' => 'Bidang :attribute harus lebih besar dari :value kilobita.',
'string' => 'Isian :attribute harus lebih besar dari :value karakter.',
'array' => 'Isian :attribute harus lebih dari :value item.',
],
'gte' => [
'numeric' => 'Isian :attribute harus lebih besar dari atau sama dengan :value.',
'file' => 'Bidang :attribute harus lebih besar dari atau sama dengan :value kilobita.',
'string' => 'Isian :attribute harus lebih besar dari atau sama dengan :value karakter.',
'array' => 'Isian :attribute harus mempunyai :value item atau lebih.',
],
'image' => 'Isian :attribute harus berupa gambar.',
'in' => 'Isian :attribute yang dipilih tidak valid.',
'in_array' => 'Bidang isian :attribute tidak terdapat dalam :other.',
'integer' => 'Isian :attribute harus merupakan bilangan bulat.',
'ip' => 'Isian :attribute harus berupa alamat IP yang valid.',
'ipv4' => 'Isian :attribute harus berupa alamat IPv4 yang valid.',
'ipv6' => 'Isian :attribute harus berupa alamat IPv6 yang valid.',
'json' => 'Isian :attribute harus berupa JSON string yang valid.',
'lt' => [
'numeric' => 'Isian :attribute harus kurang dari :value.',
'file' => 'Bidang :attribute harus kurang dari :value kilobita.',
'string' => 'Isian :attribute harus kurang dari :value karakter.',
'array' => 'Isian :attribute harus kurang dari :value item.',
],
'lte' => [
'numeric' => 'Isian :attribute harus kurang dari atau sama dengan :value.',
'file' => 'Bidang :attribute harus kurang dari atau sama dengan :value kilobita.',
'string' => 'Isian :attribute harus kurang dari atau sama dengan :value karakter.',
'array' => 'Isian :attribute harus tidak lebih dari :value item.',
],
'max' => [
'numeric' => 'Isian :attribute seharusnya tidak lebih dari :max.',
'file' => 'Bidang :attribute seharusnya tidak lebih dari :max kilobita.',
'string' => 'Isian :attribute seharusnya tidak lebih dari :max karakter.',
'array' => 'Isian :attribute seharusnya tidak lebih dari :max item.',
],
'mimes' => 'Isian :attribute harus dokumen berjenis : :values.',
'mimetypes' => 'Isian :attribute harus dokumen berjenis : :values.',
'min' => [
'numeric' => 'Isian :attribute harus minimal :min.',
'file' => 'Bidang :attribute harus minimal :min kilobita.',
'string' => 'Isian :attribute harus minimal :min karakter.',
'array' => 'Isian :attribute harus minimal :min item.',
],
'not_in' => 'Isian :attribute yang dipilih tidak valid.',
'not_regex' => 'Format isian :attribute tidak valid.',
'numeric' => 'Isian :attribute harus berupa angka.',
'present' => 'Bidang isian :attribute wajib ada.',
'regex' => 'Format isian :attribute tidak valid.',
'required' => 'Bidang isian :attribute wajib diisi.',
'required_if' => 'Bidang isian :attribute wajib diisi bila :other adalah :value.',
'required_unless' => 'Bidang isian :attribute wajib diisi kecuali :other memiliki nilai :values.',
'required_with' => 'Bidang isian :attribute wajib diisi bila terdapat :values.',
'required_with_all' => 'Bidang isian :attribute wajib diisi bila terdapat :values.',
'required_without' => 'Bidang isian :attribute wajib diisi bila tidak terdapat :values.',
'required_without_all' => 'Bidang isian :attribute wajib diisi bila tidak terdapat ada :values.',
'same' => 'Isian :attribute dan :other harus sama.',
'size' => [
'numeric' => 'Isian :attribute harus berukuran :size.',
'file' => 'Bidang :attribute harus berukuran :size kilobyte.',
'string' => 'Isian :attribute harus berukuran :size karakter.',
'array' => 'Isian :attribute harus mengandung :size item.',
],
'starts_with' => 'The :attribute must start with one of the following: :values',
'string' => 'Isian :attribute harus berupa string.',
'timezone' => 'Isian :attribute harus berupa zona waktu yang valid.',
'unique' => 'Isian :attribute sudah ada sebelumnya.',
'uploaded' => 'Isian :attribute gagal diunggah.',
'url' => 'Format isian :attribute tidak valid.',
'uuid' => 'The :attribute must be a valid UUID.',
/*
|---------------------------------------------------------------------------------------
| Baris Bahasa untuk Validasi Kustom
|---------------------------------------------------------------------------------------
|
| Di sini Anda dapat menentukan pesan validasi kustom untuk atribut dengan menggunakan
| konvensi "attribute.rule" dalam penamaan baris. Hal ini membuat cepat dalam
| menentukan spesifik baris bahasa kustom untuk aturan atribut yang diberikan.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|---------------------------------------------------------------------------------------
| Kustom Validasi Atribut
|---------------------------------------------------------------------------------------
|
| Baris bahasa berikut digunakan untuk menukar atribut 'place-holders'
| dengan sesuatu yang lebih bersahabat dengan pembaca seperti Alamat Surel daripada
| "surel" saja. Ini benar-benar membantu kita membuat pesan sedikit bersih.
|
*/
'attributes' => [
],
];
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!