<?php
namespace App\Security\Voter;
use App\Form\Model\Features;
use App\Utils\VoterHelper;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
class FeaturesVoter extends Voter
{
private const EDIT = 'edit';
/**
* FeaturesVoter constructor.
*/
public function __construct()
{
}
protected function supports(string $attribute, mixed $subject): bool
{
return $subject instanceof Features && in_array($attribute, [self::EDIT], true);
}
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
{
return VoterHelper::voteOnAttribute($attribute, $subject, $token, 'features');
}
}