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/otto-das.komma.pro/app/Attributes/Currency.php
<?php
namespace App\Attributes;
use Komma\KMS\Core\Attributes\Traits\ExplanationTrait;
use Komma\KMS\Core\Attributes\Traits\LabelTrait;
use Komma\KMS\Core\Attributes\Traits\PlaceholderTextTrait;
use Komma\KMS\Core\Attributes\Traits\ReadOnlyTrait;

/**
 * Class TextField
 * @package App\Kms\Core\Attributes
 */
class Currency extends Attribute
{
    use LabelTrait;
    use PlaceholderTextTrait;
    use ReadOnlyTrait;
    use ExplanationTrait;

    /** @var $min int The minimum allowed value */
    private $min;
    /** @var $max int The maximum allowed value */
    private $max;
    /** @var $step float The legal number intervals */
    private $step;
    /** @var $previewVat bool */
    private $previewVat;

    /**
     * TextField constructor.
     * @param string $labelText
     */
    public function __construct(string $labelText)
    {
        $this->setLabelText($labelText);
        $this->readOnly = false;
        $this->previewVat = true;

        parent::__construct();
    }

    /**
     * Returns a view that visually represents this attribute
     *
     * @return \Illuminate\Contracts\View\View
     */
    public function render()
    {
        return view('kms/attributes.currency', [
            'attribute' => $this
        ]);
    }

    /**
     * @return int
     */
    public function getMin(): ?int
    {
        return $this->min;
    }

    /**
     * @param int $min
     * @return Currency
     */
    public function setMin(int $min):Currency
    {
        $this->min = $min;
        return $this;
    }

    /**
     * @return int
     */
    public function getMax(): ?int
    {
        return $this->max;
    }

    /**
     * @param int $max
     * @return Currency
     */
    public function setMax(int $max):Currency
    {
        $this->max = $max;
        return $this;
    }

    /**
     * @return float
     */
    public function getStep(): ?float
    {
        return $this->step;
    }

    /**
     * @param float $step
     * @return Currency
     */
    public function setStep(float $step):Currency
    {
        $this->step = $step;
        return $this;
    }

    /**
     * Get value overwrite
     * because the value may not be an empty string but should be 0 then
     *
     * @return string
     */
    public function getValue(): string
    {
        $value = $this->value;
        if(empty($value)) $value = '';

        return $value;
    }

    /**
     * @return bool
     */
    public function getPreviewVat(): bool
    {
        return $this->previewVat;
    }

    /**
     * @param bool $previewVat
     * @return Currency
     */
    public function setPreviewVat(bool $previewVat): Currency
    {
        $this->previewVat = $previewVat;
        return $this;
    }
}