ObjekPajak.php
2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?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;
}
}