mdn-backend / app /Shared /Validation /OwnershipValidator.php
internationalscholarsprogram's picture
feat(membership): admin-driven account creation, real estate tier/investment work, in-progress monorepo migration state
b2dcf0f
Raw
History Blame Contribute Delete
425 Bytes
<?php
namespace App\Shared\Validation;
use App\Shared\Exceptions\ApiException;
class OwnershipValidator
{
public function ensureOwner(?string $actualOwnerId, string $expectedOwnerId, string $message = 'The record is not available.'): void
{
if ($actualOwnerId === null || $actualOwnerId !== $expectedOwnerId) {
throw new ApiException('RESOURCE_NOT_FOUND', $message, [], 404);
}
}
}