HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/gggg.komma.nl/app/Helpers/HasEmptyCheckWithBooleans.php
<?php declare(strict_types=1);


namespace App\Helpers;

use Komma\KMS\Core\AbstractTranslationModel;

/**
 * Extended version of the is empty check on AbstractTranslationModels
 * Trait IsEmptyWithHeroActiveTrait
 *
 * @package App\Helpers
 * @mixin AbstractTranslationModel
 */
trait HasEmptyCheckWithBooleans
{
    public function isEmpty(): bool
    {
        $empty = true;

        foreach($this->attributes as $attributeName => $value)
        {
            if(substr($attributeName, -3) == '_id' || in_array($attributeName, $this->booleanAttributes ?? [])) continue;
            if($value != "" && $value != "[]") {
                $empty = false;
                break;
            }
        }

        return $empty;
    }
}