Pelanggan
extends Model
in package
uses
HasFactory, LogsActivity
Class Pelanggan
Represents a customer (Pelanggan) in the system.
Table of Contents
Properties
- $email : string
- $is_suspended : bool
- $is_terminated : bool
- $nama : string
- $paket_id : int
- $tgl_aktivasi : string
- $tgl_instalasi : string
- $user_id : int
- $appends : mixed
- $casts : mixed
- $fillable : mixed
- $table : mixed
- The attributes that are mass assignable.
Methods
- bills() : MorphMany
- Get all bills associated with the customer.
- currentManualPayment() : HasOne
- Get the current manual payment for the customer.
- generateMonthlyBill() : void
- Generate a monthly bill for the customer.
- getActivitylogOptions() : LogOptions
- Get the activity log options for the model.
- getCurrentBillDueDateFormattedAttribute() : string|null
- Get the formatted current bill due date.
- getCurrentBillPeriodFormattedAttribute() : string|null
- Get the formatted current bill period.
- getCurrentBillStatusAttribute() : string
- Get the current bill status for the customer.
- getFotoPerangkatUrlAttribute() : string|null
- Get the URL to the device photo.
- getIsTrialAttribute() : bool
- Determine if the customer is in trial period.
- getKtpUrlAttribute() : string|null
- Get the URL to the KTP file.
- getTglAktivasiFormattedAttribute() : string|null
- Get the formatted activation date.
- kabupaten() : BelongsTo
- Get the regency (kabupaten) associated with the customer.
- kecamatan() : BelongsTo
- Get the district (kecamatan) associated with the customer.
- kelurahan() : BelongsTo
- Get the sub-district (kelurahan) associated with the customer.
- manualPayments() : HasMany
- Get all manual payments associated with the customer.
- paket() : BelongsTo
- Get the package associated with the customer.
- paymentReceipts() : HasMany
- Get all payment receipts associated with the customer.
- provinsi() : BelongsTo
- Get the province associated with the customer.
- scopeActive() : Builder
- Scope a query to only include active customers.
- scopeTrial() : Builder
- Scope a query to only include trial customers.
- user() : BelongsTo
- Get the user associated with the customer.
Properties
public
string
$email
The email address of the customer.
$is_suspended
public
bool
$is_suspended
Whether the customer is suspended.
$is_terminated
public
bool
$is_terminated
Whether the customer is terminated. ... (other properties as needed)
$nama
public
string
$nama
The name of the customer.
$paket_id
public
int
$paket_id
The ID of the associated package.
$tgl_aktivasi
public
string
$tgl_aktivasi
The activation date.
$tgl_instalasi
public
string
$tgl_instalasi
The installation date.
$user_id
public
int
$user_id
The ID of the associated user.
$appends
protected
mixed
$appends
= ['foto_perangkat_url', 'ktp_url', 'tgl_aktivasi_formatted', 'current_bill_status', 'current_bill_period_formatted', 'current_bill_due_date_formatted', 'is_trial']
$casts
protected
mixed
$casts
= ['latitude' => 'float', 'longitude' => 'float', 'tgl_aktivasi' => 'datetime', 'tgl_instalasi' => 'datetime', 'tgl_habis_kontrak' => 'datetime', 'prorate_period' => 'datetime', 'is_suspended' => 'boolean', 'is_terminated' => 'boolean', 'lama_kontrak' => 'integer', 'is_automatic_bill' => 'boolean']
$fillable
protected
mixed
$fillable
= [
'jenis_identitas',
'no_identitas',
'email',
'provinsi_id',
'kabupaten_id',
'kecamatan_id',
'kelurahan_id',
'latitude',
'longitude',
'alamat',
'nama',
'nama_cp',
'no_telp_cp',
'no_telp',
'hubungan_cp',
'alamat_cp',
'perangkat',
'tipe_perangkat',
'serial_number',
'foto_perangkat',
'tgl_aktivasi',
'lama_kontrak',
'tgl_habis_kontrak',
'ip_address',
'mac_address',
'site_id',
'ssid',
'username',
'password',
'is_suspended',
'is_terminated',
'paket_id',
'user_id',
'verified_at',
// New column for verification timestamp
'ktp',
'diskon',
'nominal_diskon',
'jenis_diskon',
'tgl_instalasi',
'suspend_reason',
'suspend_at',
'terminate_reason',
'terminate_at',
'is_automatic_bill',
'prorate_period',
'prorate_amount',
]
$table
The attributes that are mass assignable.
protected
mixed
$table
= 'pelanggan'
Methods
bills()
Get all bills associated with the customer.
public
bills() : MorphMany
Return values
MorphManycurrentManualPayment()
Get the current manual payment for the customer.
public
currentManualPayment() : HasOne
Return values
HasOnegenerateMonthlyBill()
Generate a monthly bill for the customer.
public
generateMonthlyBill([int|null $month = null ][, int|null $year = null ]) : void
Parameters
- $month : int|null = null
-
The month for the bill.
- $year : int|null = null
-
The year for the bill.
getActivitylogOptions()
Get the activity log options for the model.
public
getActivitylogOptions() : LogOptions
Return values
LogOptionsgetCurrentBillDueDateFormattedAttribute()
Get the formatted current bill due date.
public
getCurrentBillDueDateFormattedAttribute() : string|null
Return values
string|nullgetCurrentBillPeriodFormattedAttribute()
Get the formatted current bill period.
public
getCurrentBillPeriodFormattedAttribute() : string|null
Return values
string|nullgetCurrentBillStatusAttribute()
Get the current bill status for the customer.
public
getCurrentBillStatusAttribute() : string
Return values
stringgetFotoPerangkatUrlAttribute()
Get the URL to the device photo.
public
getFotoPerangkatUrlAttribute() : string|null
Return values
string|nullgetIsTrialAttribute()
Determine if the customer is in trial period.
public
getIsTrialAttribute() : bool
Return values
boolgetKtpUrlAttribute()
Get the URL to the KTP file.
public
getKtpUrlAttribute() : string|null
Return values
string|nullgetTglAktivasiFormattedAttribute()
Get the formatted activation date.
public
getTglAktivasiFormattedAttribute() : string|null
Return values
string|nullkabupaten()
Get the regency (kabupaten) associated with the customer.
public
kabupaten() : BelongsTo
Return values
BelongsTokecamatan()
Get the district (kecamatan) associated with the customer.
public
kecamatan() : BelongsTo
Return values
BelongsTokelurahan()
Get the sub-district (kelurahan) associated with the customer.
public
kelurahan() : BelongsTo
Return values
BelongsTomanualPayments()
Get all manual payments associated with the customer.
public
manualPayments() : HasMany
Return values
HasManypaket()
Get the package associated with the customer.
public
paket() : BelongsTo
Return values
BelongsTopaymentReceipts()
Get all payment receipts associated with the customer.
public
paymentReceipts() : HasMany
Return values
HasManyprovinsi()
Get the province associated with the customer.
public
provinsi() : BelongsTo
Return values
BelongsToscopeActive()
Scope a query to only include active customers.
public
scopeActive(Builder $query) : Builder
Parameters
- $query : Builder
Return values
BuilderscopeTrial()
Scope a query to only include trial customers.
public
scopeTrial(Builder $query) : Builder
Parameters
- $query : Builder
Return values
Builderuser()
Get the user associated with the customer.
public
user() : BelongsTo