File: D:/HostingSpaces/sdo/sdoschoonmaak.nl/app/KommaApp/Kms/Core/Attributes/KmsTextFieldCurrency.php
<?php
/**
*
*
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
namespace App\KommaApp\Kms\Core\Attributes;
use View;
class KmsTextFieldCurrency extends KmsAttribute
{
public $label;
public $placeholder;
public $taxField;
public $basic = false;
public $default_value;
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);
$this->taxField = $this->getOption('taxField', $key);
$this->setValueFromData($this->getOption('data', $key), $key);
$this->default_value = $this->getOption('default_value', '');
if ($this->getOption('type', $key) == 'basic') $this->basic = true;
}
public function setValueFromData($data, $key)
{
if ($data == $key) return false;
if (is_string($data)) {
$data = explode('@', $data);
$method = array_pop($data);
$class = $data[0];
$modelId = $this->getOption('model_id', null);
$this->value = \App::make($class)->{$method}($modelId, $this->siteId);
}
}
public function getValue($post = false)
{
if(!$this->value) $this->value = $this->default_value;
return $this->value;
}
public function render()
{
return View::make('kms/attributes.textFieldCurrency', [
'attribute' => $this
]);
}
}