File: D:/HostingSpaces/SBogers10/komma.pro/app/KommaApp/Kms/Core/Attributes/KmsPassword.php
<?php
/**
*
*
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
namespace App\KommaApp\Kms\Core\Attributes;
use Hash;
use View;
class KmsPassword extends KmsAttribute{
public $label;
public $placeholder;
function __construct($key, $value, array $options = [], array $errors = [], $siteId = null, $languageId = null, $section = null)
{
parent::__construct($key, $value, $options, $errors, $siteId, $languageId, $section);
$this->label = $this->getOption('label', $key);
$this->placeholder = $this->getOption('placeholder', $key);
}
public function render()
{
return View::make('kms/attributes.password', [
'attribute' => $this
]);
}
public function getValidation()
{
if( $this->section->getModelId() and ! $this->getValue()) {
return [];
}
return $this->getOption('validation');
}
/**
* Get the value for saving
* @return mixed
*/
public function getValue($post = false)
{
if($this->value == ''){
return null; // don't save this attribute (save the original value)
}
return Hash::make($this->value);
}
}