Files
ERP-upgrade/app/Models/ActivityLog.php
2026-09-22 08:06:31 +00:00

30 lines
651 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ActivityLog extends Model
{
protected $fillable = [
'user_id', 'loggable_type', 'loggable_id', 'action',
'old_data', 'new_data', 'ip_address', 'user_agent'
];
protected $casts = [
'old_data' => 'array',
'new_data' => 'array',
];
// Links back to the User who made the change
public function user()
{
return $this->belongsTo(StaffMember::class);
}
// Links back to the affected Model (Client, Server, VpnConfig, etc.)
public function loggable()
{
return $this->morphTo();
}
}