* @license MIT */ namespace Pterodactyl\Addons\AdvancedAdmin\Models; use Illuminate\Database\Eloquent\Model; class RoleAuditLog extends Model { protected $table = 'addon_role_audit_log'; public $timestamps = false; protected $fillable = [ 'actor_id', 'action', 'target_type', 'target_id', 'payload', 'ip_address', ]; protected $casts = [ 'payload' => 'array', 'created_at' => 'datetime', ]; /** * Write a structured audit entry. */ public static function record( ?int $actorId, string $action, string $targetType = '', ?int $targetId = null, array $payload = [], string $ip = '' ): void { static::create([ 'actor_id' => $actorId, 'action' => $action, 'target_type' => $targetType, 'target_id' => $targetId, 'payload' => $payload, 'ip_address' => $ip ?: request()->ip(), 'created_at' => now(), ]); } }