e29a5891c8
Reviewed-on: #5 Co-authored-by: ISMAIL MASSERAN <ismail@koppkb.com> Co-committed-by: ISMAIL MASSERAN <ismail@koppkb.com>
72 lines
1.5 KiB
PHP
72 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Simulasi extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'simulasi';
|
|
|
|
protected $fillable = [
|
|
'tarikh_lelong',
|
|
'masatamat_lelong',
|
|
'kali',
|
|
'harga_emas_asas',
|
|
'jbg',
|
|
'cajlelong',
|
|
'fasa',
|
|
'success_import',
|
|
'tagujrah',
|
|
];
|
|
|
|
public function cawangan()
|
|
{
|
|
return $this->belongsToMany(Cawangan::class, 'cawangan_simulasi', 'simulasi_id', 'caw_id')->withPivot('id', 'export_data_stsdate', 'fasa');
|
|
}
|
|
|
|
// TBD - NOT RECOMMENDED FUNCTION BELOW
|
|
public function cawanganFromSimulasiBid()
|
|
{
|
|
return $this->belongsToMany(Cawangan::class, 'simulasibid', 'simulasi_id', 'caw_id');
|
|
}
|
|
|
|
public function cawanganSimulasi()
|
|
{
|
|
return $this->hasMany(CawanganSimulasi::class, 'simulasi_id', 'id');
|
|
}
|
|
|
|
public function simulasiBid()
|
|
{
|
|
return $this->hasMany(SimulasiBid::class, 'simulasi_id', 'id');
|
|
}
|
|
|
|
public function simkarat()
|
|
{
|
|
return $this->hasMany(SimKarat::class, 'simulasi_id', 'id');
|
|
}
|
|
|
|
public function simkarat_temp()
|
|
{
|
|
return $this->hasMany(SimKarat_temp::class, 'simulasi_id', 'id');
|
|
}
|
|
|
|
public function simulasiBidMarhun()
|
|
{
|
|
|
|
return $this->hasManyThrough(
|
|
|
|
SimulasiBidMarhun::class,
|
|
SimulasiBid::class,
|
|
'simulasi_id',
|
|
'simulasibid_id',
|
|
'id',
|
|
'id'
|
|
);
|
|
|
|
}
|
|
}
|