Files
pterodactyl-panel/app/Actions/Allocations/UpdateAllocationNotes.php
T

28 lines
796 B
PHP
Raw Normal View History

2026-10-05 18:10:18 -04:00
<?php
declare(strict_types=1);
namespace Pterodactyl\Actions\Allocations;
use Pterodactyl\Contracts\Allocations\UpdatesAllocationNotes;
2026-10-11 14:10:47 -04:00
use Pterodactyl\Facades\Activity;
2026-10-05 18:10:18 -04:00
use Pterodactyl\Models\Allocation;
final class UpdateAllocationNotes implements UpdatesAllocationNotes
{
public function update(Allocation $allocation, ?string $notes): Allocation
{
2026-10-11 14:10:47 -04:00
$original = $allocation->notes;
2026-10-05 18:10:18 -04:00
$allocation->forceFill(['notes' => $notes])->save();
2026-10-11 14:10:47 -04:00
if ($original !== $notes) {
Activity::event('server:allocation.notes')
->subject($allocation->server, $allocation)
->property(['allocation' => $allocation->toString(), 'old' => $original, 'new' => $notes])
->log();
}
2026-10-08 17:40:00 -04:00
return $allocation;
2026-10-05 18:10:18 -04:00
}
}