for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Omatech\Mage\Core\Repositories\Permissions;
use Omatech\Mage\Core\Domains\Permissions\Contracts\AttachedPermissionInterface;
use Omatech\Mage\Core\Domains\Permissions\Contracts\PermissionInterface;
use Omatech\Mage\Core\Repositories\PermissionBaseRepository;
class AttachedPermission extends PermissionBaseRepository implements AttachedPermissionInterface
{
/**
* @param PermissionInterface $permission
* @return bool
*/
public function attached(PermissionInterface $permission): bool
$model = $this->query()->find($permission->getId());
return ($model->roles->count() + $model->users->count()) > 0;
}