<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SysAuditLog extends Model
{
    protected $table = 'sys_audit_log';

    protected $primaryKey = 'Log_Id';

    public $timestamps = false;

    protected $fillable = [
        'Table_Name',
        'Record_Id',
        'Action',
        'R_Status',
        'Status_Remark',
        'Old_Data',
        'New_Data',
        'Changed_By',
        'Changed_At',
        'IP_Address',
        'Session_Id',
        'Remark'
    ];

    protected $casts = [
        'Old_Data' => 'array',
        'New_Data' => 'array'
    ];

    public function actionMaster()
    {
        return $this->belongsTo(ActionMaster::class, 'Action', 'Act_Id');
    }

     public function rstatus()
    {
        return $this->belongsTo(ActionMaster::class, 'R_Status', 'Act_Id');
    }

    public function user()
    {
        return $this->belongsTo(UserMaster::class, 'Changed_By', 'Usr_Id');
    }
}
