File: D:/HostingSpaces/marisrental/boldt.tech/app/Komma/Kms/Core/Attributes/Password.php
<?php
namespace App\Komma\Kms\Core\Attributes;
use App\Komma\Kms\Core\Attributes\Traits\LabelTrait;
use App\Komma\Kms\Core\Attributes\Traits\PlaceholderTextTrait;
use App\Komma\Kms\Core\Attributes\Traits\ReadOnlyTrait;
class Password extends Attribute
{
use PlaceholderTextTrait;
use ReadOnlyTrait;
/**
* @var string $labelText
*/
private $labelText = '';
/**
* @var string $repeatLabelText
*/
private $repeatLabelText = '';
/**
* Password constructor.
* @param string $password The text of the title
*/
public function __construct(string $password = '')
{
parent::__construct();
$this->setValue($password);
}
/**
* Returns true if the password is an empty string.
* Notice: When the password is an empty string, the result of getValue is not an empty string!
* That is why this method is needed.
*/
public function isEmpty()
{
return !$this->value || $this->value == '';
}
/**
* @return string The hashed password.
*/
public function getValue(): string
{
return \Hash::make($this->value);
}
/**
* Returns a view that visually represents this attribute
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('kms/attributes.password', [
'attribute' => $this
]);
}
/**
* @return string
*/
public function getLabelText()
{
return $this->labelText;
}
/**
* @param string $labelText
* @return $this
*/
public function setLabelText(string $labelText)
{
$this->labelText = $labelText;
return $this;
}
/**
* @return string
*/
public function getRepeatLabelText()
{
return $this->repeatLabelText;
}
/**
* @param string $repeatLabelText
* @return $this
*/
public function setRepeatLabelText(string $repeatLabelText)
{
$this->repeatLabelText = $repeatLabelText;
return $this;
}
}