Menambahkan migration untuk field tambahan pada tabel customers: - Menambahkan field home_rt dan home_rw untuk RT/RW alamat rumah - Menambahkan field ktp_rt dan ktp_rw untuk RT/RW alamat KTP - Menambahkan field local_ref dengan tipe TEXT untuk referensi lokal panjang - Semua field dibuat nullable untuk fleksibilitas data - Menambahkan index untuk kombinasi RT/RW untuk performa query - Menambahkan comment pada setiap field untuk dokumentasi - Menyediakan method down() lengkap untuk rollback migration - Menggunakan tipe data yang sesuai untuk setiap field
42 lines
885 B
PHP
42 lines
885 B
PHP
<?php
|
|
|
|
namespace Modules\Webstatement\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Modules\Basicdata\Models\Branch;
|
|
|
|
class Customer extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'customer_code',
|
|
'name',
|
|
'address',
|
|
'province',
|
|
'city',
|
|
'district',
|
|
'village',
|
|
'postal_code',
|
|
'branch_code',
|
|
'date_of_birth',
|
|
'email',
|
|
'sector',
|
|
'customer_type',
|
|
'birth_incorp_date',
|
|
'home_rt',
|
|
'home_rw',
|
|
'ktp_rt',
|
|
'ktp_rw',
|
|
'local_ref'
|
|
];
|
|
public function accounts(){
|
|
return $this->hasMany(Account::class, 'customer_code', 'customer_code');
|
|
}
|
|
|
|
public function branch(){
|
|
return $this->belongsTo(Branch::class, 'branch_code', 'code');
|
|
}
|
|
}
|