f5874b956d
- Add agreement_printed_at timestamp to pampasan table for tracking printed agreements - Update jenis handling for semporna v2 processing logic - Refactor barangkes controller eager loading for improved performance - Remove obsolete jenis migration files and consolidate schema changes - Update related models and controllers for semporna v2 compatibility
103 lines
2.6 KiB
PHP
103 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use App\Audit;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class Palsu extends Model
|
|
{
|
|
protected $table = 'palsu';
|
|
protected $primaryKey = 'recno';
|
|
public $timestamps = false;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'recno',
|
|
'kodcaw',
|
|
'norujukan',
|
|
'teller',
|
|
'nota',
|
|
'nilaimarhun',
|
|
'jbg',
|
|
'untung',
|
|
'untungonepercent',
|
|
'untungcajlain',
|
|
'pembiayaan',
|
|
'status',
|
|
];
|
|
|
|
// public static function boot()
|
|
// {
|
|
// parent::boot();
|
|
|
|
// $current = Carbon::now();
|
|
// $current = new Carbon();
|
|
|
|
// static::created(function (Poskod $poskod) use($current){
|
|
|
|
// Audit::create([
|
|
// 'users' => request()->all()['user']['name'],
|
|
// 'actions' => 'Tambah poskod',
|
|
// 'norujukan' => $poskod->recno,
|
|
// 'new_data' => $poskod->toJson(),
|
|
// 'old_data' => '',
|
|
// 'kodcaw' => request()->all()['user']['cawangan'],
|
|
// 'created_at' => $current,
|
|
// 'updated_at' => $current,
|
|
// ]);
|
|
|
|
// });
|
|
|
|
|
|
// static::updated(function (Poskod $poskod) use($current) {
|
|
|
|
// Audit::create([
|
|
// 'users' => request()->all()['user']['name'],
|
|
// 'actions' => 'Kemaskini poskod',
|
|
// 'norujukan' => $poskod->recno,
|
|
// 'new_data' => $poskod->toJson(),
|
|
// 'old_data' => json_encode($poskod->getOriginal()),
|
|
// 'kodcaw' => request()->all()['user']['cawangan'],
|
|
// 'created_at' => $current,
|
|
// 'updated_at' => $current,
|
|
// ]);
|
|
|
|
// });
|
|
// }
|
|
|
|
/**
|
|
* The attributes excluded from the model's JSON form.
|
|
*
|
|
* @var array
|
|
*/
|
|
// protected $hidden = [],
|
|
|
|
// public function negeri(): BelongsTo
|
|
// {
|
|
// return $this->belongsTo(Negeri::class, 'kodnegeri', 'kodnegeri');
|
|
// }
|
|
|
|
// public function daerah(): BelongsTo
|
|
// {
|
|
// return $this->belongsTo(Daerah::class, 'koddaerah', 'koddaerah');
|
|
// }
|
|
|
|
public function tebus(): HasOne
|
|
{
|
|
return $this->hasOne(Tebus::class, 'norujukan', 'norujukan');
|
|
}
|
|
|
|
public function gadai(): HasOne
|
|
{
|
|
return $this->hasOne(Gadai::class, 'norujukan', 'norujukan');
|
|
}
|
|
}
|